Aliases in Git

These are my notes on aliases in git.

Ankr Store on Amazon, keep your electronics charged by the best! If you buy something, I get a small commission and that makes it easier to keep on writing. Thank you in advance if you buy something.



Aliases in git can make your command line experience easier. Many commands are
not intuitive and it is hard to remember the important options that go with
them. By using an alias, you can encapsulate one lengthy command into a
1-2 letter alias, whatever makes sense to you. 

Here are some examples you can do from the command line:
git config --global alias.co 'checkout'
git config --global alias.br 'branch'
git config --global alias.cm 'commit -m'
git config --global alias.st 'status'

Of course, you can set the alias as anything you wish.
This means you can type:
git st
This will invoke the status command. The other aliases for commands work the
same way. Make other aliases as it seems useful for you. For anything that
seems difficult to remember, make an alias for it. 

Some more aliases that are helpful for me are:
git config --global alias.p 'push'
git config --global alias.f 'fetch'
git config --global alias.lo 'log --onleline'
git config --global alias.last 'log -l head --stat'
git commit --global alias.rv 'remote -v'


To see the aliases you have created, in case you forget, like me:
git config --global -l