gitcsvgit-history

How to find git commits which deleted lines in a file


I have a large CSV file where data usally only get appended and then git committed. But I am curious if there were some commits in the past which deleted lines from this file. To date, several hundred commits have been made on this file.

Is there an easy way to tell if there were git commits which deleted lines?


Solution

  • If you just want to answer your question with "yes/no", then running git log -p and searching (/) for ^-[^-] would be a quick and dirty way to find removed lines (the regexp means lines starting with - but not more than one, because that would match the --- header for each diff).