Created
October 23, 2020 08:09
-
-
Save suncle1993/207a222f0b13aec2f1ad222c97822e44 to your computer and use it in GitHub Desktop.
git 禁止在master上push
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 | |
protected_branch='master' | |
remote_branch_prefix="refs/heads/" | |
protected_remote_branch=$remote_branch_prefix$protected_branch | |
while read local_ref local_sha remote_ref remote_sha | |
do | |
if [ "$protected_remote_branch" == "$remote_ref" ]; then | |
echo " git hooks: Do not commit to $protected_branch branch" | |
exit 1 | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment