Skip to content

Instantly share code, notes, and snippets.

@yoshikischmitz
Last active August 29, 2015 14:07
Show Gist options
  • Save yoshikischmitz/180a573cf405d75d941c to your computer and use it in GitHub Desktop.
Save yoshikischmitz/180a573cf405d75d941c to your computer and use it in GitHub Desktop.
.git/hooks/pre-commit
#!/bin/sh
#
# Prevents commits to master.
# Put in .git/hooks/pre-commit
# Bypass with --no-verify flag on commit
if [ $(git rev-parse --abbrev-ref HEAD) = "master" ];
then
echo "You cannot commit to master"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment