Created
October 22, 2014 17:10
-
-
Save kdimatteo/eeed7a8788c1544e72aa to your computer and use it in GitHub Desktop.
Disallow force pushing to master
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/bash | |
# this file is ./git/hooks/pre-push | |
protected_branch='master' | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
if [ $protected_branch = $current_branch ] | |
then | |
echo "y u do this? (You can not push to master)" | |
exit 1; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment