This post is basically a copy of pimping out git log. I just made some modifications to Bart’s alias to fit my personal preferences.
This code creates an alias named lg for the git:
1
git config --global alias.lg "log --graph --pretty=format:'%Cred%h -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>'"
Here is an explanation of what that command does:
1
git config --global alias.lg "..."
This instruction creates a custom git command that when called is going to execute whatever string you passed to it.
1
log --graph --pretty=format:'%Cred%h -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>'
This is the log command with some useful modifiers.
–graph Shows a graph of the branches and merges
–pretty=format:’%Cred%h -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>’ Specifies a format to show the commit message. %C specifies a color. %h means abbreviated commit hash. %d shows the current position of other branches. %Creset resets color to default. %s is the commit message. %ci Is the commit date in ISO 8601 format. %an means author name.
With this information you should be able to modify it to fit your needs.
To use the alias just type in a terminal:
1
git lg
git
github
]