Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
# To enable this hook, rename this file to "pre-commit" and add it to .git/hooks/
# of C/P the following block in your existing .git/hooks/pre-commit
#IMPORTANT - for the hook to be active run:
# chmod +x .git/hooks/pre-commit
if [ `git diff --cached --name-only | grep -o Gemfile | wc -l` -eq 1 ]
then
echo "------------------- ERROR ------------------------"
echo "Both your Gemfile and your Gemfile.lock must be committed"
echo "------------------ END ERROR ---------------------"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment