[Insight-developers] Odd git behavior with code reversion.

Brad King brad.king at kitware.com
Thu Sep 29 12:57:05 EDT 2011


On 9/29/2011 12:20 PM, M Stauffer (V) wrote:
> But when I do 'git blame' on the file the commit listed for the lines in
> question is 0642b914, which is the original commit. Shouldn't git blame
> show dc7a10 as having reverted the change? It would be more helpful if
> it did, to quickly see where the code reverted.

The "git blame" command will show you the history of lines *currently*
in the file as of the blamed version.  If you want to see the reverse,
do this:

  git blame --reverse dc7a10..6cdfac --  Modules/Registration/HighDimensionalMetrics/include/itkImageToImageObjectMetric.hxx

That will show the lines as they appeared in dc7a10 but annotated with
the commit in which they last existed.  For lines that still exist it
will show 6cdfac.  For lines that were removed you will see the hash
of the last commit that still had the lines.  In this case that is
2f8eff, the parent of 6cdfac.

-Brad


More information about the Insight-developers mailing list