Skip to content

Instantly share code, notes, and snippets.

@t-buss
Created July 11, 2018 12:31
Show Gist options
  • Save t-buss/3162933c70dc213fd1cbfdb4e09f941c to your computer and use it in GitHub Desktop.
Save t-buss/3162933c70dc213fd1cbfdb4e09f941c to your computer and use it in GitHub Desktop.
Git Hook to not commit to master branch
#!/bin/sh
BRANCH=`git symbolic-ref --short HEAD`
if [ $BRANCH = "master" ]
then
echo "Error: commiting to master is probably not what you want. Create another branch."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment