Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
pre-commit prevent master commits
#!/bin/bash
echo -e "[PREVENT] --> init (wait a second)"
BRANCH=`git rev-parse --abbrev-ref HEAD`
if [ $BRANCH == master ]; then
echo -e "[PREVENT] --> Non shall commit to master!"
exit 1
else
echo -e "[PREVENT] --> Prevent commit approved"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.