git log -S can search for code deleted in the past

Tadashi Shigeoka ·  Fri, November 18, 2016

To search for code deleted in the past with git, you can use git log -S search_word to search for commits containing the search word.

Git | ギット

Use git log -S to search in the history for commits that changed . Add an optional -p to see the diff as well.

If you want to check the commit contents as well, use the -P option together.

git log -P -S search_word

git log -S is convenient when you occasionally want to investigate “When was that code deleted?”

That’s all from the Gemba.