Skip to content

Instantly share code, notes, and snippets.

@joerixaop
Created February 4, 2011 14:03
Show Gist options
  • Save joerixaop/811139 to your computer and use it in GitHub Desktop.
Save joerixaop/811139 to your computer and use it in GitHub Desktop.
Git post commit hook to remind me not to add console.log statements
​​#!/bin/sh
# Detects a forgotten console.log statement
# Could be made a pre-commit hook forcing the issue, but then adding jQuery.js becomes cumbersome
if $(git show HEAD | grep -q '^\+.*console\.log')
then
RED='\e[1;31m'
NC='\e[0m'
echo -e "${RED}WARNING:${NC}"
echo " You left in a console.log statement in your code, please reconsider commiting this"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment