I am trying (but failing miserably) to make a git pre-commit hook that checks for the presence of a var_dump in my modified files and exits if it finds one. The problem that I'm having is that it appears to always be aborting the commit. Here is the contents of my pre-commit file:

VAR=$(git diff | grep -w "var_dump")
if [ -z $VAR ]; then
  echo "You've left a var_dump in one of your files! Aborting commit..."
  exit 1
fi
Edit
Report