]> git.nbdom.net Git - nb.git/commitdiff
etc/profile.d/git.sh
authorroot <sys@15gifts.com>
Tue, 26 Sep 2017 20:09:13 +0000 (21:09 +0100)
committerroot <sys@15gifts.com>
Tue, 26 Sep 2017 20:09:13 +0000 (21:09 +0100)
etc/profile.d/git.sh

index 459a5e0fb7e50a1cd8eb20e4fcc9c6bc1d860764..17a4db23755e42a510134dac0c21c3af7673f2ab 100644 (file)
@@ -169,3 +169,22 @@ git_conn_check() {
   return 0
 }
 
+# NB 26.09.17: TODO 
+git_merge_from() {
+  local usage="Usage: git_merge_from BRANCH, but does not push !"
+  local from=${1:?$usage}
+  local branch=$(git branch 2>/dev/null|awk '/^\*/{print $2}')
+  [ -z "$branch" ] && echo "$usage" 1>&2 && return 1
+  echo "git checkout $from && git pull && git checkout $branch && git merge $from"
+  return 0
+}
+
+# NB 26.09.17: TODO 
+git_merge_to() {
+  local usage="Usage: git_merge_to BRANCH and auto push branch to !"
+  local to=${1:?$usage}
+  local branch=$(git branch 2>/dev/null|awk '/^\*/{print $2}')
+  [ -z "$branch" ] && echo "$usage" 1>&2 && return 1
+  echo "git checkout $to && git pull && git merge $branch && git push && git checkout $branch"
+  return 0
+}