Created
August 27, 2021 23:48
-
-
Save eladg/6386ae16aa96471c4283e253811c72ad to your computer and use it in GitHub Desktop.
prevent commit on master/dev/prod 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
#!/bin/sh | |
branch="$(git rev-parse --abbrev-ref HEAD)" | |
if [ "$branch" = "master" ] || [ "$branch" = "dev" ] || [ "$branch" = "prod" ]; then | |
echo "You can't commit directly to $branch branch" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment