In in 95% of my time I type “git add . -A” directly followed by “git commit -m “message” in the Git version control system.
That is a lot of typing for a very common case. Fortunately git allows to add an alias for the command. To add an alias for git add and git commit to your git configuration, open your .git/config file and add the following.
[alias] ac = !git add -A && git commit
Alternative you can use the –global flag from the command line:
git config --global alias.ac '!git add -A && git commit'
You now can add and commit to your Git repository via the command:
git ac -m "message"
Unfortunately alias seems not to be supported on the window implementation of git (msysgit). See the bug report: msysgit does not support alias definition.
I hope this helps. More details can be found in my Git Tutorial. You may want to follow me on Twitter.
5 Responses to Git Alias – git add -A and git commit in one command