Created
November 15, 2018 16:12
-
-
Save milankamilya/2521ce9cc146e3cfa8b2e14ababadca2 to your computer and use it in GitHub Desktop.
Restrict developers from pushing to specific branch or branches
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
branch="$(git rev-parse --abbrev-ref HEAD)" | |
#---------------------------------------------------------------- | |
# RESTRICT BRANCHES FROM DIRECT PUSH | |
#---------------------------------------------------------------- | |
if [ "$branch" = "master" ] || [ "$branch" = "release" ]; then | |
echo "You can't commit directly to $branch" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@milankamilya thanks!