Skip to content

Instantly share code, notes, and snippets.

@stereosupersonic
Created September 20, 2017 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stereosupersonic/e42e4eeb62259246cf6c47a59b6c9259 to your computer and use it in GitHub Desktop.
Save stereosupersonic/e42e4eeb62259246cf6c47a59b6c9259 to your computer and use it in GitHub Desktop.
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