From e294bf24bd665f9fac944e21ef6729fd3c956204 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sat, 7 Feb 2015 01:06:33 +0000 Subject: [PATCH] nb-git-create --- etc/bashrc.function | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/etc/bashrc.function b/etc/bashrc.function index 017f1fa3..f0fe6c52 100644 --- a/etc/bashrc.function +++ b/etc/bashrc.function @@ -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() { -- 2.47.3