2

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?

Simon Schürg
  • 2,134
  • 2
  • 20
  • 31
  • What about [`git blame --reverse`](https://stackoverflow.com/a/11245051/10871900)? – dan1st Jan 19 '21 at 22:08
  • 1
    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). – chelmertz Jan 19 '21 at 22:14
  • 1
    Thanks @chelmertz this worked for me. If you post this as an answer I can accept it. – Simon Schürg Jan 19 '21 at 22:21

1 Answers1

2

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).

chelmertz
  • 20,399
  • 5
  • 40
  • 46