Last Updated: September 22, 2018
· filipekiss

A better git log

So, are you tired of this old and bored git log screen?


How about this one, instead?


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


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( 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.

98 Responses
Add your response


This doesn't work for individual files

over 1 year ago ·

@askjuise Thank. I've fixed. :)

over 1 year ago ·

You guys can try this one :

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

this will:
-one commit per line

-show graph of commits

-abbreviated commit IDs

-dates relative to now

-show commit references (like git log --decorate)

-lots of colour

-show author of the commit

over 1 year ago ·

Cool Filipe! Thanks!

over 1 year ago ·

Great Filipe! Thanks :)

over 1 year ago ·

Very nice, thanks man

over 1 year ago ·

thats amazing. thanks!

over 1 year ago ·

Thanks man! For copy-pasting change-logs, here's an ascii friendly version:

git log --graph --pretty=format:'%h -%d %s (%cr) <%an>' --abbrev-commit

...and the alias:

git config --global alias.lg-ascii "log --graph --pretty=format:'%h -%d %s (%cr) <%an>' --abbrev-commit"
over 1 year ago ·

lg = !tig

google "tig" for more info

over 1 year ago ·

This is great, thanks!

Rather than a git alias, I opted for a bash alias by adding this line to my .bash_profile:
alias gitlog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Now I have gitlog and gitlog -p.
Thanks again!

over 1 year ago ·
over 1 year ago ·

Try this
git log --oneline --abbrev-commit --all --graph --decorate --color

It will give you one line commits, plus branching.

over 1 year ago ·

FYI, %h is for abbreviated commit hash, making --abbrev-commit redundant.

over 1 year ago ·

Call me old fashioned. I use the alias glo mapped to

git log --decorate --oneline --graph and that works well for me.

Or, if I'm feeling like I need something a bit different, glg , which is mapped to

git log --decorate --graph --abbrev-commit --date=relative

over 1 year ago ·

This is great! Thanks :D

over 1 year ago ·

I like this one, that shows the branch graph on the left:

history = log --graph --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
stash-list = stash list --pretty=format:'%Cblue%gd%Cred: %C(yellow)%s'q

Looks like:

over 1 year ago ·

@dshafik Mine also shows the graph :) It just happened to be a flat-line for the screenshots I've chose :P

over 1 year ago ·

Love it!

over 1 year ago ·

scm_breeze on github does something similar automatically plus a bunch of other nice aliases

over 1 year ago ·

Neat and simple...:)

over 1 year ago ·

There is no need for --abbrev-commit.

Thanks for the tip though, I trimmed mine down to:

git log --format='%Cred%h%Creset %s %Cgreen(%cr) %C(blue)<%an>%Creset%C(yellow)%d%Creset' --no-merges
over 1 year ago ·

This is great, thanks for sharing !

over 1 year ago ·

Great stuff.

over 1 year ago ·

I keep it simple with
git log --oneline --decorate --graph

This shows each commit on one line, decorates each line with any information about branches and repos and displays a graph where commits have branched or merged.

If you want to really personalise you git log with specific colours, here is an article to explain the syntax of all that in detail:


over 1 year ago ·

In my gists NOW!

over 1 year ago ·

Eu te amo! haha

over 1 year ago ·

I'd prefer to set the default to --graph --decorate, rather than cook up a new alias. :/

over 1 year ago ·

Nice! Any tips on porting this to Fish? I'm quite new to the command line stuff, and I can't find any reference to %C, string interpolation or command line styling for Fish shell. /lost

update: Okay, so the reason why I was getting an error was, I was putting white space between the '='. My bad! Carry along.

over 1 year ago ·

is kinda awesome

npm install -g ungit && ungit

if only I could post an image... oops

over 1 year ago ·

The git plugin of oh-my-zsh comes with tons of aliases, including log aliases.

  • alias glgg='git log --graph --max-count=10'
  • alias glgga='git log --graph --decorate --all'
  • alias glo='git log --oneline --decorate --color'
  • alias glog='git log --oneline --decorate --color --graph'
over 1 year ago ·

Just install tig, a much much better command line tool for git

over 1 year ago ·

Pretty sweet!, now I can read the git log so much easier

over 1 year ago ·

As of Git 1.8.3 (May 24, 2013), you can now have (automatic) more comprehensive and useful colors on commits, branches and tags using %C(auto):

git log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
over 1 year ago ·

As of Git 1.8.3 (May 24, 2013), you can now have (automatic) more comprehensive and useful colors on commits, branches and tags using %C(auto):

git log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
over 1 year ago ·

As of Git 1.8.3 (May 24, 2013), you can now have (automatic) more comprehensive and useful colors on commits, branches and tags using %C(auto):

git log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
over 1 year ago ·

Cool ;)
Take it.
Thank you Filipe.

over 1 year ago ·

awesome, Boy!

over 1 year ago ·

Wow, cool. I guess I'll look at my log now than on Bitbucket or Github. Thanks for sharing.

over 1 year ago ·

great. thanks for sharing

over 1 year ago ·


over 1 year ago ·

Great..!! thank you for sharing..

over 1 year ago ·

Thanks, i'll try it

over 1 year ago ·

Awesome, really useful! :)

over 1 year ago ·


over 1 year ago ·

Where this command saved? I can't see it in my zshrc file.

over 1 year ago ·

Thank you for this :)

over 1 year ago ·

Thanks, this is great!

over 1 year ago ·

Amigo, muchas gracias, es un excelente aporte.

over 1 year ago ·

Nice. Will use this from now on.

12 months ago ·

Using this as base I change it a little bit.

git config --global alias.lg "log --color --graph --pretty=format:'%C(#dc322f)%h%C(#b58900)%d %C(#eee8d5)%s %C(#dc322f)| %C(#586f75)%cr %C(#dc322f)| %C(#586e75)%an%Creset' --abbrev-commit"

[ Screenshot ]

10 months ago ·

This is what I was looking for. Thanks for the Guide

9 months ago ·

you can read lyrics of your fav. song on our website.

4 months ago ·

Well composed articles like yours renews my faith in today’s writers. You’ve written information I can ultimately agree with as well as make use of.

4 months ago ·

Wow great information share with me.

4 months ago ·

you can read lyrics of your fav. song on our website.

3 months ago ·

This is great, welcome improvement. I wonder why it doesn't work in Window's native CMD though. Works as expected when invoked from Git Bash, but when I use the native CMD I get the following error message "The system cannot find the file specified."

Any clue on why it happens or how to fix that? Thanks!

3 months ago ·

thanks for this post..very amazing and informative...good work and keep posting. thanks for sharing.

3 months ago ·

Your post has just save my time. Thank you!!

3 months ago ·

I used your code as an experiment - I tracked changes and updates on one of the sections of my site. The section is devoted to the best cordless telephones - Everything works perfectly. I like that you can change color as you like.

3 months ago ·

Are you in Delhi Whether you are looking for call girls in Lajpat Nagar, now your search has been completed, we introduce you to young and beautiful girls who know the skills to fully satisfy your crazy moments. To make it memorable, you can contact us our number 9899900591 For more information, you can search on our website:-

3 months ago ·

One of the happiest days of your life, you will like to hang out with a girl with whom you will feel like your girlfriend and you will get exactly the same dates. This girl is completely lost in the society. Nobody can even guess. Whom are you roaming with this girl specializes in the skill of fulfilling you completely, visit our website for complete information and call us on :-9873940964

<a href="">Faridabad escorts </a>

3 months ago ·

Ghaziabad escorts the best call girls and house wife independent escorts and grown-up services with photographs have the finest choice of Ghaziabad. Call Girls which are accessible all through the city territories. Call 9873940964

3 months ago ·

shwetakaur Escorts Knowledgeable girls Independent Service:Day/Near. Meet our ghaziabad call girls Agency high class vip best profile display bear the cost of rate for 24X7 open 9711199012

3 months ago ·

preetkour Independent Escorts in jodhpur VIP Prominent Escort Service in jodhpur,You can make escort in jodhpur a slave for the night,Book her to make today around evening time more agreeable with sexual fun. call us 9711199012

3 months ago ·

Get Stunning noida Escorts For All at very affordable prices covering all noida at Urgently book call girls whatsapp/Call 9873777170

3 months ago ·

Escorts have been in the society since the ancient times. Of course then they were known by other names and their designation and with time running so fast and society evolving from good

3 months ago ·

That is until you are alone! Once you are tucked away in your room. she unleashes her inner vixen and ushers even the shiest of men on a world-class travel designed to tap to masculinity. It requires confidence and a great aura to successfully approach women.

2 months ago ·

Thank you for posting such a great article! I found your website perfect for my needs. It contains wonderful and helpful posts. Keep up the good work!. Thank you for this wonderful Article!

2 months ago ·

Posts are very meaningful thanks to the site

2 months ago ·

Excellent post. This article is very helpful for the people and also for me. I get the some useful knowledge in this post. Thanks for sharing the informative topic, by the way

2 months ago ·

Delhi Escorts Service High Class Female Call Girls in Delhi By AnjaliKaur

about 2 months ago ·

Ghaziabad Escort | 24x7 Independent Call Girl Service in Ghaziabad ...
Ghaziabad Escorts Service provides the best outcall Independent escorts service in Ghaziabad through some of its sizzling call girls in Ghaziabad escort girls.

my partner in :

about 2 months ago ·

I am SIMMI PRADHAN 5'7" 23 years young an independent housewife. Services for erotic fun and satisfaction at reasonable rates,Call now for full happiness. Working with agencies:-

about 2 months ago ·

Informative blog, thank you so much for sharing this amazing blog.
<a href=>Top 5 Web Design Company in Delhi</a>

about 2 months ago ·

Ghaziabad offers Kavya Mahajan Ghaziabad escorts available 24/7 at Call Girls Ghaziabad. Our agency provides stunning Ghaziabad escort girls.

about 1 month ago ·

Get the best of the lyrics from

about 1 month ago ·
about 1 month ago ·

get the best of he

about 1 month ago ·

Thanks for sharing this trick it will help me a lot

about 1 month ago ·

this is health blog..please subscribe

30 days ago ·

If you contact Astrologer in Bangalore (Call Now 9779315277) PT. Rinku Sharma ji for your love affair in No 1 Love Lavatory, you can get the right love marriage expert.

29 days ago ·

Thank you so much for sharing this blog. This is really informative and valuable to me.
<a href=>Outsourced Web Hosting Support</a>

23 days ago ·

Hello guys | 9837940964 | are you looking for fresh and lovely Rozy Call Girls. Delhi Escorts Service | Contact Us Without any hesitation Book here Fresh Call girls who can fulfill your all burning desire. Plz Vzt our site
<a href="">Delhi Escorts</a><BR>

22 days ago ·

I have possessed the capacity to profit in the most brief conceivable time. After fruition of my graduation in trade spill out of one of the phenomenal schools in Delhi,

13 days ago ·

The extreme sensuous satisfaction that I receive from the broad-minded call girls in Pune is really amazing. I love to date these females often and experience the warmth of their body. Spending some quality moments with these beauties has given me exclusive memories and filled my life with better memories.

8 days ago ·

Thank you so much!

1 day ago ·