Skip to content

Instantly share code, notes, and snippets.

@tgerulaitis
Created May 19, 2014 09:29
Show Gist options
  • Save tgerulaitis/4bb87f55010a1a6fa70e to your computer and use it in GitHub Desktop.
Save tgerulaitis/4bb87f55010a1a6fa70e to your computer and use it in GitHub Desktop.
A pre-commit hook that rejects any commits containing "dev_debug" or "var_dump" in the diff.
#!/bin/sh
# Check diff for debug statements
for file in $(git diff --cached --name-only); do \
git diff --cached $file | grep -E '^\+.*(dev_debug|var_dump)' > /dev/null && \
echo "COMMIT REJECTED: Debug statements found in $file" && \
exit 1
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment