Skip to content

Instantly share code, notes, and snippets.

@KMontag42
Last active July 5, 2017 15:33
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 KMontag42/9ed35e27554a428f6c4abb082efc4e1f to your computer and use it in GitHub Desktop.
Save KMontag42/9ed35e27554a428f6c4abb082efc4e1f to your computer and use it in GitHub Desktop.
#!/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