4

Lets say I have a particular commit in git, which contains some line removals. How to easily check who authored removed lines?

What I do now is:

git blame THE_FILE.TXT THE_REVISION^

which annotates all lines as they were before the change. This requires manual scrolling and finding lines that I know are removed in next commit.

Is there any better way, to only annotate changed lines (displayed by git show or git diff)?

This is not about finding when was specific line removed (as in the other question), but doing the opposite - finding when was the removed line introduced. Still no answer to that.

An example:

https://github.com/torvalds/linux/commit/d6d211db37e75de2ddc3a4f979038c40df7cc79c#diff-b67911656ef5d18c4ae36cb6741b7965L4

The problem is to easily identify the commit which introduced the line "EXTRAVERSION = -rc4", which is now removed.

mateusza
  • 5,341
  • 2
  • 24
  • 20

1 Answers1

2

You can restrict git-blame to a given line range using its -L option. As the line number may be different in THE_REVISION^, I suggest you use -L :<regex> instead of a range of line numbers.

lrineau
  • 6,036
  • 3
  • 34
  • 47