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?
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.