Programster's Blog

Tutorials focusing on Linux, programming, and open source

Pretty Git Logs

If you want to see a graph of your commit log, then I recommend that you use the following command:

git log \
--abbrev-commit \
--oneline \
--all \
--graph \
--decorate \

Executing it should give you output similar to below:

Now you can see the flow of the changes and easily spot where branches have "died off" etc. The only thing that is annoying is that the line wrapping is ugly with the text breaking the graph, so I recommend you keep your terminal wide. If you know a solution to this then please leave a comment.

Use an Alias

That command can be hard to remember, and long to type, so I recommend adding this line to the end of your .bashrc file

alias gg="git log --oneline --abbrev-commit --all --graph --decorate --color"

Now you only have to type gg to view your logs. Now you're winning.