git ready

learn git one commit at a time
by Nick Quaranto

finding who committed what

committed 23 Feb 2009

Sometimes you may find it necessary to figure out just who committed that bug, or perhaps compliment a coworker on how efficiently an algorithm was implemented. Or maybe not, you just want to know who broke the build. Luckily, the git blame command can help with figuring out exactly who’s responsible for which line and what commit it came from.

The basic usage is simply git blame <file>. The console output usually looks like so (check out the full image!):

For those confused at what this wall of text consists of, it shows the abbreviated commit SHA, the file name it originated from, the commit author and date, line number, and then the actual line of code.

That’s great and all, but there’s plenty of other ways to get your blame on. If your code is up on GitHub, you get blame information included:

Another great way to see this information is with git-age, which is a viewer written in PyGtk. It’s actually quite neat, it shows the Gravatar associated with the commit’s email, and shows older commits with a darker gray background.

If you know of any other tricks that this command can do or other useful viewers, let us know in the comments!