Sometimes you have to take your git repository’s log to see what you did the day before (ideal in preparation for the daily stand-up). What I want is a clean overview of each commit messages, their author and the time. The output result should be easily grep-able so I can filter stuff I don’t need out.
To do this, I use the following custom
git log command:
git log --pretty=format:'%Cred%h%Creset - %C(yellow)%ae%Creset - %Cgreen%cd%Creset - %s%Creset' --abbrev-commit --date=iso
5d6ef1e - firstname.lastname@example.org - 2011-05-02 10:36:43 +0200 - Bumped to version 1.5.2 afede9e - email@example.com - 2011-05-02 10:35:53 +0200 - Fixed #29 - Sharing to facebook without a title now works properly. d9985a1 - firstname.lastname@example.org - 2011-04-23 00:13:06 -0700 - Added Travis build status to README 3e1149c - email@example.com - 2011-04-22 13:44:21 +0200 - Bumped version to 1.5.1 fcab3bf - firstname.lastname@example.org - 2011-04-22 13:43:41 +0200 - Don't test on ruby 1.9.2 for now. See issue #27 93843ec - email@example.com - 2011-04-22 13:42:29 +0200 - Fixed issue #28 - Share-to-* double-encodes titles ec56315 - firstname.lastname@example.org - 2011-04-22 12:43:41 +0200 - Fixed up utf-8 encoding for ruby 1.9.2 2146134 - email@example.com - 2011-04-22 12:39:37 +0200 - Bump Sinatra to 1.2.3 c5efbf4 - firstname.lastname@example.org - 2011-04-22 12:07:41 +0200 - Truncate long URLs in the back-end to maintain a correct layout.
Now, it’s easy to see what I did on april 22nd using grep
git log <snip> | grep 2011-04-22
You can also filter on email address to select only specific user etc. Of course, all this could be done with git, but I’m way more comfortable using grep.
To make life easy, you can create a shortcut for this log command. Add this to you
[alias] timelog = log --pretty=format:'%Cred%h%Creset - %C(yellow)%ae%Creset - %Cgreen%cd%Creset - %s%Creset' --abbrev-commit --date=iso
You can now use
git timelog in any git repository.
Learn more about git!
If you're seeing this message you've probably enabled some form of adblocker. I respect that.
I use this space to show recommended books on Amazon.com in relation to the post you just read. This generates a small income that allows me to buy a book every now and then.