Skip to content

Instantly share code, notes, and snippets.

@aklaswad
Created April 17, 2012 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aklaswad/2405579 to your computer and use it in GitHub Desktop.
Save aklaswad/2405579 to your computer and use it in GitHub Desktop.
.git/hooks/pre-commit
#!/usr/bin/env perl
use strict;
use warnings;
my $diff = `git diff --cached`;
if ( my ( $ng_word ) = $diff =~ /^\+.*(Dumper|STDERR|alert|console\.log)/m ) {
print STDERR <<"ABORT";
Bad word '$ng_word' was found. git commit was aborted!
If you believe this commit is OK, use git commit --no-verify to skip this hook.
ABORT
exit 1;
}
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment