Skip to content

Instantly share code, notes, and snippets.

@james-huston
Last active December 30, 2015 08:58
Show Gist options
  • Save james-huston/7805716 to your computer and use it in GitHub Desktop.
Save james-huston/7805716 to your computer and use it in GitHub Desktop.
Git pre-commit hook for lint checking with grunt before allowing a commit. Add it as an install script to your package.json.
#!/bin/bash
if [ ! -f .git/hooks/pre-commit ]
then
echo "Adding pre-commit hook"
echo "#!/bin/sh" > .git/hooks/pre-commit
echo "grunt jshint; exit \$?" >> .git/hooks/pre-commit
chmod ug+x .git/hooks/pre-commit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment