Last active
August 29, 2015 14:16
-
-
Save igrep/8da3ce93296d56b1372a to your computer and use it in GitHub Desktop.
間違えてmasterやdevelopにpushしてしまうあなたは今すぐこれを.git/hooks/pre-commitにコピペしなさい ref: http://qiita.com/igrep/items/b0eabaeb7b301cdc2045
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 | |
current_branch=$(git rev-parse --abbrev-ref HEAD) | |
warn_branch() { | |
echo "You can't commit on '$current_branch'!" | |
} | |
case $current_branch in | |
master) warn_branch; exit 1 ;; # Of cource you can add any other important branches as you need. | |
develop) warn_branch; exit 1 ;; # Of cource you can add any other important branches as you need. | |
*) exit 0;; | |
esac |
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
$ chmod +x .git/hooks/pre-commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment