-
-
Save thechinnster/4112235 to your computer and use it in GitHub Desktop.
.git/hooks/pre-commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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