Skip to content

Instantly share code, notes, and snippets.

@semanticart
Created December 16, 2010 22:15
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 semanticart/744108 to your computer and use it in GitHub Desktop.
Save semanticart/744108 to your computer and use it in GitHub Desktop.
#!/bin/sh
# ack the diff with a regexp to
# prevent you from adding lines (the \+ at the beginning indicates an added line in the diff)
# that introduce console.log
# and are not commented out (the \s* before console.log)
has_console_log=$(git diff --cached | ack '^\+\s*console\.log\(.*\)')
if [ "$has_console_log" != "" ]
then
echo "ERROR: You have console.log in your commit. Remove them."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment