Quicker Git Add Commit Push
Add this to your .bash_profile
:
function gcp () {
if [ -z "$1" ]
then
read -p "Commit Message:" MSG
else
MSG="$1"
fi
git add .
git commit -am "$MSG"
git push
}
now whenever you want to commit and push just execute
gcp "This is the comment"
if you don't supply a commit message it will prompt you for one.
If you'd rather git open your default editor to comment, use this:
function gcp () {
git add .
git commit -a
git push
}
but you can get the best of both worlds, one-liner messages, OR editor messages with something like this:
function gcp() {
git add .
if [ -z "$1" ]
then
git commit -a
else
git commit -am "$1"
fi
git push
}
Written by Joel Kirchartz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#