Adding a command Alias to git

Imagine you wan to run:

git log –all –graph –decorate –oneline

But you don’t wan t to write all that each time but instead something shorter like “logh”

Well you can add a “git alias” in this way:

git config –global alias.logh “log –all –graph –decorate –oneline”

Voila, go and try it out! just do “git logh” in your desired repository

Tip: if you want you can edit this alias and other settings editing this file:

vi ~/.gitconfig

Leave a Reply