Find out when the last use of variable was removed from the git repo

73 views Asked by At

I have an unused variable in my code, and I wonder how things got to be this way. Can I use git grep (or something else) to find out easily?

1

There are 1 answers

1
phd On BEST ANSWER
git log -Svarname

where varname is the name your variable.

See https://git-scm.com/docs/git-log#git-log--Sltstringgt:

Look for differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file.