Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # this hook is in SCM so that it can be shared
- # to install it, create a symbolic link in the projects .git/hooks folder
- #
- # i.e. - from the .git/hooks directory, run
- # $ ln -s ../../git-hooks/pre-commit.sh pre-commit
- #
- # to skip the tests, run with the --no-verify argument
- # i.e. - $ 'git commit --no-verify'
- FILES='(js|css|rb)'
- FORBIDDEN='(binding.pry|console.log|\!important|focus\: true)'
- GREP_COLOR='4;5;37;41'
- if [[ $(git diff --cached --name-only | grep -E $FILES) ]]; then
- git diff --cached --name-only | grep -E $FILES | \
- xargs grep --color --with-filename -n -E $FORBIDDEN && \
- echo "Looks like you are trying to commit something you shouldn't. Please fix your diff, or run 'git commit --no-verify' to skip this check, if you must." && \
- exit 1
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement