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.



Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to and affiliated sites. More info.