Better Git log
Contents
Some of the settings to make git log
better.
Decorate commit
The --decorate
option will show references to your commit. For example, where
your HEAD
is, where your master points to etc. To use --decorate
by default:
git config --global log.decorate true
Show short commit hash
By default, git shows long commit hash for each commit. To show a short commit
hash, we can use the --abbrev-commit
option. To use --abbrev-commit
by
default:
git config --global log.abbrevCommit true
Show commit graph
To show a graphical representation of commit, which is handy when we have
merged commit or multiple branches, we can use --graph
option:
git log --graph
Use color for log output
Use color to differentiate different part of log message:
git config format.pretty "%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(green)(%cr) %C(cyan)<%an>%Creset"
After this setup, git-log output will be like the following: