I have a section of code in an old version of software that has been removed from the current version. I want to find when this section was removed from the code base. Currently my way of doing this is to manually diff my integration branch against each of the old commits, but there are far to many commits between the version of the file that has the code, and my current version.
So in short, if I ahve code on lines 44-52 of a file in an old version, that does not exist in the new version how can I find the commit when it was removed?
Try git log -S"<code>" -- <file path(s)>
, it shows commits in which occurrence of specified string changes.
That means if u remove a code piece, then the reference to that code will decrease by 1.
git log -S"hello world" -- src/
This shows commits in which "hello world" is added or removed.