Last active
August 29, 2015 14:22
-
-
Save ijin/f3c6c8aeb40587a3364c to your computer and use it in GitHub Desktop.
prevent pushing to master or deploy branch using git hooks
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/bash | |
RED=`tput setaf 1` | |
RESET=`tput sgr0` | |
while read local_ref local_sha1 remote_ref remote_sha1 | |
do | |
if [[ "${remote_ref##refs/heads/}" =~ ^(master|deploy) ]]; then | |
echo "${RED}Do not push to ${remote_ref##refs/heads/} branch!!!${RESET}" | |
echo | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment