Sedate Alien Sedate Alien - 1 year ago 38
Git Question

Git blame -- prior commits?

I love the

git blame
command, it is very useful for tracking down people who don't own up to writing code. :-)

However, it is possible to see who edited a specific line before the commit reported by
git blame
, e.g. a history of commits for a given line?

For example, I run the following (on the superb

$ git blame -L10,+1 src/options.cpp
^fe25b6d (Ben Gardner 2009-10-17 13:13:55 -0500 10) #include "prototypes.h"

How can I find out who edited that line before commit
? And who edited it before that commit? I am sure this would be possible, but my git-fu is weak.

Answer Source
git blame -L10,+1 fe25b6d^ -- src/options.cpp

You can specify a revision for git blame to look back starting from (instead of the default of HEAD); fe25b6d^ is the parent of fe25b6d.