Last active
April 8, 2016 19:08
-
-
Save ashimaathri/f9a01ed9406e7fd76e3ff83de68fc0a3 to your computer and use it in GitHub Desktop.
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 | |
# Remember to make this file executable and place it in .git/hooks with the name pre-push | |
protected_branch='master' | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
if [ $protected_branch = $current_branch ] | |
then | |
echo "You were going to push to master and I can't allow that. Disable this hook if you really want to continue." | |
exit 1 # push will not execute | |
else | |
exit 0 # push will execute | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment