Skip to content

Instantly share code, notes, and snippets.

@misostack
Created November 10, 2017 09:42
Show Gist options
  • Save misostack/90c77dd4baa99bad94a428cad249aac8 to your computer and use it in GitHub Desktop.
Save misostack/90c77dd4baa99bad94a428cad249aac8 to your computer and use it in GitHub Desktop.
pre-commit-prevent-master
#!/bin/bash
echo -e "[PREVENT] --> init (wait a second)"
BRANCH=`git rev-parse --abbrev-ref HEAD`
if [ $BRANCH == master ]; then
echo -e "[PREVENT] --> You are not allowed to commit to master!"
exit 1
else
echo -e "[PREVENT] --> Prevent commit passed"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment