From 91de4f76903bb378da2eb636982a7975bdb9936c Mon Sep 17 00:00:00 2001 From: William Carroll Date: Wed, 4 May 2016 11:13:19 -0700 Subject: [PATCH] Adds git shorthand functions for shell --- .git_functions.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .git_functions.sh diff --git a/.git_functions.sh b/.git_functions.sh new file mode 100644 index 000000000..5eaafbb49 --- /dev/null +++ b/.git_functions.sh @@ -0,0 +1,21 @@ +# combine fetch and rebase (git frebase) +function wgfreebase { + if [ -z $1 ]; then + branchname="$(git symbolic-ref HEAD 2> /dev/null | cut -f3 -d'/')" + else + branchname="$1" + fi + + git fetch origin "$branchname" && git rebase origin/"$branchname" +} + +# push to current branch +function wgpush { + if [ -z $1 ]; then + branchname="$(git symbolic-ref HEAD 2> /dev/null | cut -f3 -d'/')" + else + branchname="$1" + fi + + git push origin $branchname +}