Skip to content

Instantly share code, notes, and snippets.

@fanzeyi
Created May 22, 2014 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanzeyi/c79b2a7099a6d66d04a9 to your computer and use it in GitHub Desktop.
Save fanzeyi/c79b2a7099a6d66d04a9 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ $(git diff --cached | grep "debugger|console\.log" -E | grep -E "^\+" | wc -l) -gt 0 ]; then
echo "[Pre-commit check] Detected debug code in commit. Remove it!"
exit 1
fi
exit 0
@fanzeyi
Copy link
Author

fanzeyi commented May 22, 2014

Usage

$ cd <Git Repo Root Dir>
$ wget "https://gist.github.com/fanzeyi/c79b2a7099a6d66d04a9#file-pre-commit-sh" -O .git/hooks/pre-commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment