A lot of pre-commit hooks use git diff-index --cached -S REV to find changes which add or remove a particular pattern. So in your case, git diff-index --cached -Sdebugger HEAD. You may want to add -u to get a diff as well, otherwise it just identifies the offending file.