Add in ~/.bash_profile
for adding, committing and pushing with one command put:
function g() { git commit -a -m "$*"; git push; }
Usage:
g your commit message
g your commit message 'message'
No quotes are needed although you can't use semicolons or parenthesis in your commit messages (single quotes are allowed). If you want to any of these just simply put double quotes in you message, e.g.:
g "your commit message; (message)"
To create a comment in your message do:
g "your commit message:
> your note"
There's also a function for adding and committing in a similar way:
function c() { git add --all; git commit -m "$*"; }
Works exactly the same way that g
function and has the same constraints. Just put c
instead.
E.g.
c your commit message
You can also add an alias for pushing to the remote:
alias p='git push'
Usage:
p
That amounts into 2 letters, c
and p
you use while working with your git repository. Or you can use g
instead to do it all with only one letter.
Full list of aliases and functions:
https://gist.github.com/matt360/0c5765d6f0579a5aa74641bc47ae50ac