We’ve recently switched one of our big projects at work over to Git from Perforce recently. Overall, its been good but has had quite the learning curve for all of us to shift to this new paradigm. One of the things we’ve struggled with a lot is just being able to easily see what’s changed in our commits, comparing branch to branch etc. I’m always looking for ways to slice through the information that git will report back.
I came across an interesting feature of git log yesterday. It allows you to pass a simple grep string to the git log command and only the commits that contain that string in their changeset description will be returned. This is handy for us since we label all of our descriptions with our Version One story or task ID.
The command is straightforward in its usage:
git log —grep=
This turns what could be an unwieldy output of git log commits to a simple eloquent output of a single (or shorter list) of commits:
$ git log –grep=B-03725
commit 938ec97072e6689a1065fe4aaf4ae6ae75352491
Author: Kyle Hayes < my_email >
Date: Mon Nov 15 08:42:15 2010 -0800
FE integration refs: B-03725