Skip to content

Instantly share code, notes, and snippets.

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 bquorning/19ae41cc1222ec2cdf54 to your computer and use it in GitHub Desktop.
Save bquorning/19ae41cc1222ec2cdf54 to your computer and use it in GitHub Desktop.
.git/hooks/pre-commit
#!/bin/sh
STAGED=$(git diff --cached --name-only --diff-filter=ACM | grep -e '\.rb$' -e '\.rake$' -e '\.ru$' -e Capfile -e 'Gemfile$')
if [ "$STAGED" ]; then
./bin/rubocop -- $STAGED
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment