-
-
Save joaocunha/de641a9fe800e4e1d859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Prevent commits against the 'master' branch | |
if [[ `git rev-parse --abbrev-ref HEAD` == 'master' ]] | |
then | |
echo 'You cannot commit to the master branch!' | |
echo 'Stash your changes and apply them to another branch, using:' | |
echo 'git stash' | |
echo 'git checkout <branch>' | |
echo 'git stash apply' | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment