Skip to content

Instantly share code, notes, and snippets.

@getdave
Created September 25, 2013 16:15
Show Gist options
  • Save getdave/6702061 to your computer and use it in GitHub Desktop.
Save getdave/6702061 to your computer and use it in GitHub Desktop.
Git Pre-Commit hook bash script to stop people committing directly to the master branch. Typically useful in a GitFlow based workflow. Installation would be as simple as ```` ln -s ../../pre-commit.sh .git/hooks/pre-commit ````
git branch | grep "* master" && echo 'COMMIT REJECTED - you are not allowed to commit directly to the master branch you fool!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment