How to find which commits deleted a line containing a specific line?

I have a file that is no longer referenced anywhere in my code. I am looking for a search that captures a link to this file. (I do not know which files were used for the link).

I know that git log -S will find commits that either added or removed this line. I'm actually looking for a way to limit this search to only those lines that have been deleted. Is it possible?

+6
source share
1 answer

I would like to see an easier solution. But with some shell scripts, it would look like this:

for id in $(git log -Sstring --pretty=%h) do if [ "$(git show $id | grep "+.*string")" != "" ] then echo $id fi done 
+1
source

All Articles