Last active
December 25, 2015 06:29
-
-
Save necccc/6932090 to your computer and use it in GitHub Desktop.
git merge workflow helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# work branch to feature branch | |
w2b = "!f() { b=\"$1\"; w=`git status --porcelain -bs|awk 'NR==1{print $2}'`; if [[ ! $w =~ "work" ]]; then echo "Not on a workbranch! Aborting..."; exit 1; fi; git checkout branches/$b; git pull; git merge $w --no-ff; }; if [[ $? == 0 ]]; then git checkout $w; fi; f" | |
# work branch to feature branch with push | |
w2bp = "!f() { b=\"$1\"; w=`git status --porcelain -bs|awk 'NR==1{print $2}'`; if [[ ! $w =~ "work" ]]; then echo "Not on a workbranch! Aborting..."; exit 1; fi; git checkout branches/$b; git pull; git merge $w --no-ff; if [[ $? == 0 ]]; then git push; if [[ $? == 0 ]]; then git checkout $w; fi; fi; }; f" | |
# work branch to master | |
w2m = "!f() { w=`git status --porcelain -bs|awk 'NR==1{print $2}'`; if [[ ! $w =~ "work" ]]; then echo "Not on a workbranch! Aborting..."; exit 1; fi; git checkout master; git pull; git merge $w --no-ff; if [[ $? == 0 ]]; then git checkout $w; fi; }; f" | |
# work branch to release tag | |
w2r = "!f() { r=\"$1\"; w=`git status --porcelain -bs|awk 'NR==1{print $2}'`; if [[ ! $w =~ "work" ]]; then echo "Not on a workbranch! Aborting..."; exit 1; fi; git checkout tags/release-$r; git pull; git merge $w --no-ff; if [[ $? == 0 ]]; then git checkout $w; fi; }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment