Created
September 14, 2014 06:42
-
-
Save yuanqing/eca80df6e07da03536b3 to your computer and use it in GitHub Desktop.
`git commit` + `git push` in a single command
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
function gp() { | |
git commit -m '$1' | |
if [ "$#" -eq 2 ]; then | |
git push origin $2 | |
else | |
git push origin master | |
fi | |
} | |
$ gp 'foo bar' | |
#=> git commit -m 'foo bar' && git push origin master | |
$ gp 'foo bar' dev | |
#=> git commit -m 'foo bar' && git push origin dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment