Skip to content

Instantly share code, notes, and snippets.

@igrep
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igrep/8da3ce93296d56b1372a to your computer and use it in GitHub Desktop.
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
#!/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
$ chmod +x .git/hooks/pre-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment