-2

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?

Mark VY
  • 1,489
  • 16
  • 31

1 Answers1

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

phd
  • 82,685
  • 13
  • 120
  • 165