Whenever I'm using git, I generally add, commit, and push at the same time. So I created an alias in bash to make it simpler:
alias acp='git add -A;git commit -m "made changes";git push'
How do I make it so that the I can change the commit message from "made changes" to something else while I'm running the acp command? For example:
acp "added the Timer Class"
The above I would want to run everything that the acp command does and make "added the timer class" the commit message. How would I do that?
Thanks!
Best Answer
An alias cannot accept parameters, so you need to create a function:
as always, store it in
~/.bashrc
and source it withsource ~/.bashrc
.Or better (good hint, binfalse) to avoid performing a command if the previous was not successful, add
&&
in between them:Execute it with
It is important that you use double quotes, otherwise it will just get the 1st parameter.