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

M Stauffer (V) mstauff at verizon.net
Thu Sep 29 13:25:28 EDT 2011


>> 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/itkImageToI
>mageObjectMetric.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.

Thanks Brad, the reverse option looks very useful.

So in the case I described, do you think git blame purposely show the
original commit because the line that's currently in the file is the
same as it was in that original commit, even though it changed
inbetween?

-M



More information about the Insight-developers mailing list