Git: How do I find which commit deleted a line?

git
11,473

Use git blame with the --reverse option:

$ git blame --reverse START.. file.ext

where START is a revision which still contains the line in question.

Share:
11,473

Related videos on Youtube

Author by

BruteCode

Updated on September 18, 2022

Comments

  • BruteCode about 1 month

    I know I added a line in a particular commit and can see it in a private GitHub account. In my current branch it isn't in there any more. How do I find which commit removed it?

  • cweiske
    cweiske over 7 years
    The then following commit is the one that removes the line.
  • polynomial_donut
    polynomial_donut almost 4 years
    It would be good to add what this does, namely showing each line with the last commit on which it still existed.