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:

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:

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.

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:

git lg


[ git  github  ]
Hooking your github project to Travis-CI
Contributing to OpenHatch project
Pushing and deleting remote branches with git
Creating and applying patches with git
How to delete a commit in git, local and remote