Skip to content

Instantly share code, notes, and snippets.

@yuanqing
Created September 14, 2014 06:42
Show Gist options
  • Save yuanqing/eca80df6e07da03536b3 to your computer and use it in GitHub Desktop.
Save yuanqing/eca80df6e07da03536b3 to your computer and use it in GitHub Desktop.
`git commit` + `git push` in a single command
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