]> git.nbdom.net Git - nb.git/commitdiff
nb-git-create
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 7 Feb 2015 01:06:33 +0000 (01:06 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 7 Feb 2015 01:06:33 +0000 (01:06 +0000)
etc/bashrc.function

index 017f1fa36b7c53e0ec5ae0f96c1576fc0f4c21fa..f0fe6c525ef256888aad21193c80d9cc51e54f43 100644 (file)
@@ -24,13 +24,40 @@ case "$OSTYPE" in darwin*)
 
 esac
 
+function nb-git-create() {
+  declare name="${1%.git}"
+  declare dir=$(basename $name)
+  declare repo='git@git.nbdom.net'
+  [ -e "$dir" ] && echo "$dir already exists!" 1>&2 && return 1
+
+  ssh git@git.nbdom.net "git init --bare ${name}.git" || return
+  git clone $repo:${name}.git || return
+
+  echo "Got to directory: $dir"
+  cd $dir || return
+
+  echo "$name
+=============
+
+## Synopsis
+
+DESCRIPTION
+" > README.md
+  git init
+  git add *
+  git commit -m "Created by $FUNCNAME"
+  git push --set-upstream origin master
+  git remote add origin $repo:${name}.git
+  git push -u origin master
+}
+
 function nb-git-clone() {
-  git clone git@git.nbdom.net:$1.git
+  git clone git@git.nbdom.net:${1%.git}.git
 }
 
 git-commit-push() {
   git commit -m "$@" -a
-  git push || echo "Try: git push --set-upstream origin master"
+  git push #|| echo "Try: git push --set-upstream origin master"
 }
 
 git-commit-push-add() {