This is making me nuts.
How do I find code that was deleted?
I ended up finding where it was created with this:
$ git log --pretty=oneline -S'some code'
And that's good enough, but I was also curious to find where it got deleted, and so far, no dice.
First, I tried git diff HEAD..HEAD^|grep 'some code'
, expanding the range each time, until I found the lines where it was removed. Nice, so suppose I found it on range HEAD^^..HEAD^^^
, then I do git show HEAD^^^
and git show HEAD^^
with grep
, but the code is nowhere to be found!
Then I read up a bit on git bisect
, and sure enough, it gives me a single revision where the culprit is supposed to be... Again, git show rev|grep 'some code'
comes up empty...
What the? What am I doing wrong?
Thanks!