Tip: Show git log with colors

If you want to show colorful git log output, simply parse in --decorate parameter:

git log --decorate

Before:

commit 07f125fcb4e02bacea6aa24e84994bec60c200f9
Author: Trung Lê 
Date:   Mon May 23 10:20:52 2011 +1000

    fix promo index view

After:

commit 07f125fcb4e02bacea6aa24e84994bec60c200f9
Author: Trung Lê 
Date:   Mon May 23 10:20:52 2011 +1000

    fix promo index view

Note: OSX’s Terminal default won’t display color output, you have to add few tweaks to ~/.gitconfig

[color]
    ui = auto
[core]
    pager = less -R

Furthermore, you can render the output into one line with parameter --oneline

git log --oneline --decorate

Before:

ee24a24 (bump-rspec) Fixed issue with test_app Gemfile.
e75990d Remove deprecated gemspec executables
58620e5 (fix-order-history-event-duplication) Introducing respond_with and respond_override methods

After:

ee24a24 (bump-rspec) Fixed issue with test_app Gemfile.
e75990d Remove deprecated gemspec executables
58620e5 (fix-order-history-event-duplication) Introducing respond_with and respond_override methods
Advertisements

About Jones Lee

Nothing much about me..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: