This will call git blame
for every meaningful revision to show line $LINE
of file $FILE
:
git log --format=format:%H $FILE | xargs -L 1 git blame $FILE -L $LINE,$LINE
As usual, the blame shows the revision number in the beginning of each line. You can append
| sort | uniq -c
to get aggregated results, something like a list of commits that changed this line. (Not quite, if code only has been moved around, this might show the same commit ID twice for different contents of the line. For a more detailed analysis you'd have to do a lagged comparison of the git blame
results for adjacent commits. Anyone?)