random post image

git log is so 2005

Whether you love terminal customization or feel more Rand Paul with your ‘.bash_profile’, this tip will change your life. This is one of the first commands I run on a new machine, and it has been an invaluable visualization tool for as long as I can remember. 

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"

― via Filipe Kiss

This command creates a new ‘git lg’ alias to use instead of the default ‘git log’. What does running git lg do exactly? It turns this mess:

git log example

into this:

git lg example

Beautiful, isn’t it? You get more information above the fold by removing noise. And as an added bonus, you can see your branches ebb and flow across your repository. This can be super helpful for navigation and rebasing, and invaluable within merge-based workflows like GitHub’s.


Follow @FredKSchott for more discussion and git tips. Got any favorites of your own? I’d love to see them. Leave a comment below and spread the productivity/joy.

comments powered by Disqus