Skip to content

Instantly share code, notes, and snippets.

@milankamilya
Created November 15, 2018 16:12
Show Gist options
  • Save milankamilya/2521ce9cc146e3cfa8b2e14ababadca2 to your computer and use it in GitHub Desktop.
Save milankamilya/2521ce9cc146e3cfa8b2e14ababadca2 to your computer and use it in GitHub Desktop.
Restrict developers from pushing to specific branch or branches
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
@provSoniyaPatwa
Copy link

@milankamilya thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment