Git aliases
We already mentioned Git aliases and their purpose; in this section, I will suggest only a few more, to help make things easier.
Shortcuts to common commands
One thing you may find useful is to shorten common commands such as git checkout
and so on; therefore, useful aliases can include the following:
[1] ~/grocery (master)
$ git config --global alias.co checkout
[2] ~/grocery (master)
$ git config --global alias.br branch
[3] ~/grocery (master)
$ git config --global alias.ci commit
[4] ~/grocery (master)
$ git config --global alias.st status
Another common practice is to shorten a command, adding one or more options you use all the time; for example, set a git cm <commit message>
command shortcut to the alias git commit -m <commit message>
:
[5] ~/grocery (master)
$ git config --global alias.cm "commit -m"
[6] ~/grocery (master)
$ git cm "My commit message"
On branch master
nothing to commit, working tree clean
Creating commands
Another common way to...