Skip to content

Instantly share code, notes, and snippets.

@Zaidos
Created October 18, 2016 22:01
Show Gist options
  • Save Zaidos/120c558ea861ab0b03a8d6446ed187f4 to your computer and use it in GitHub Desktop.
Save Zaidos/120c558ea861ab0b03a8d6446ed187f4 to your computer and use it in GitHub Desktop.
A Better Git Log
URL: https://coderwall.com/p/euwpig/a-better-git-log
So, are you tired of this old and bored git log screen?
Picture
How about this one, instead?
Picture
It's simple. Just type in:
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
I guess that's a bit too long, eh? Let's just make an alias. Copy and paste the line below on your terminal:
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"
And every time you need to see your log, just type in
git lg
Or, if you want to see the lines that changed
git lg -p
Picture
Hope you like it :)
PS: It seems that there's no way to view larger images, so I've linked bigger versions of them on the tip. Just click the image. Thanks to @basus(http://www.twitter.com/basus) for the note
Update: As some people were reporting, the git lg -p command wasn't working. As pointed out by the user universal_property at reddit, removing the -- at the end made it work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment