Created
February 26, 2015 22:06
-
-
Save sandro/68896d6d5273465788a1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# credit to https://gist.github.com/stefansundin/d465f1e331fc5c632088 | |
PUSH_COMMAND=`ps -ocommand= -p $PPID` | |
while read local_ref local_sha remote_ref remote_sha | |
do | |
if [[ "$remote_ref" =~ master && "$PUSH_COMMAND" =~ force|delete|-f ]]; then | |
echo "Prevented force-push to $remote_ref. This is a very dangerous command." | |
echo "If you really want to do this, use --no-verify to bypass this pre-push hook." | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment