Git aliases
In Chapter 2, Git Fundamentals – Working Locally we already mentioned Git aliases and their purpose; in this paragraph, I will suggest only a few more to help you make things easier.
Shortcuts to common commands
One thing you can find useful is to shorten common commands like git checkout
and so on; therefore, these are some useful aliases:
$ git config --global alias.co checkout $ git config --global alias.br branch $ git config --global alias.ci commit $ git config --global alias.st status
Another common practice is to shorten a command by adding one or more options that you use all the time; for example set a git cm <commit message>
command shortcut to alias git commit –m <commit message>
:
$ git config --global alias.cm "commit -m" ...
Get Git Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.