A Git alias for logs, Version 2.0

A while back, I wrote a post about how to improve the log command in git by adding a customized alias for it. I’ve been fairly happy with that alias, but I kept missing one thing: A date, or some similar indicator of the age of each commit. Today, I finally set aside time to improve it, and here`s the result:

lg = log --format=\"%h: %Cgreen%an %ar %Creset(%ci) %n         %s\" -10

The result now includes both the age of each commit (e.g. numbers of hours, or similar), and the actual date and time. For readability the message is rendered on a separate line, and indented to make the short version of the commit hash stand out clearly to the left.

Also, since what I’m mostly after when I look at the log is who commited it and when, I’ve rendered the user`s name and the age of the commit in green:

This now gives me all the info I need, and is still way more compact than the original log command. I hope you can find it useful too.

Engage and contribute for the common benefit of mankind!

This site uses Akismet to reduce spam. Learn how your comment data is processed.