Created
November 30, 2012 12:39
-
-
Save rafeca/4175527 to your computer and use it in GitHub Desktop.
Pre-commit hook to alert the committer before committing changes dangerous files. Save it in .git/hooks/pre-commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
FILES="app/config/config.production.yaml\|app/config/application.production.yaml" | |
if [ "`git diff-index --cached HEAD | grep \"$FILES\"`" ]; then | |
exec < /dev/tty | |
echo "You are commiting changes to a live config file. Are you sure? [y/n] " | |
read -s -n 1 sure | |
if [[ $sure == "y" ]]; then | |
exit 0 | |
else | |
echo "Aborting commit..." | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works well, thanks for posting this.