Created
October 23, 2020 08:08
-
-
Save suncle1993/94974dd0cd3a413ac0fbba47d6b7347e to your computer and use it in GitHub Desktop.
git禁止在master上commit
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' | |
current_branch=$(git rev-parse --symbolic --abbrev-ref HEAD) | |
if [ "$protected_branch" == "$current_branch" ]; then | |
echo "git hooks: Do not commit to $current_branch branch" | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment