Place the code below into this file: (Inside your local project repo)
.git/hooks/pre-commit
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1; then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
for FILE in `git diff-index --name-status $against -- | cut -c3-` ; do
# Check if javascript contains console.log()
if grep --quiet 'console\.log' "$FILE"
then
echo "***$FILE*** contains console.log() in this commit! Please remove it or IE users will die!"
exit 0
fi
done
exit
And run this command:
chmod +x .git/hooks/pre-commit