14

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?

16

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.

| improve this answer | |
  • The then following commit is the one that removes the line. – cweiske Jul 2 '15 at 8:36
  • 4
    It would be good to add what this does, namely showing each line with the last commit on which it still existed. – polynomial_donut Jan 16 '19 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.