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"
Creating commands
Another common way to customize the Git experience is to create commands you think should exist, as we did in Chapter 2, Git Fundamentals – Working Locally with the git tree
command.
git unstage
The classic example is the...