Skip to content

Instantly share code, notes, and snippets.

@ms2sato
Created January 15, 2016 04:42
Show Gist options
  • Save ms2sato/030df11fc9acd471a31b to your computer and use it in GitHub Desktop.
Save ms2sato/030df11fc9acd471a31b to your computer and use it in GitHub Desktop.
masterへのcommit、pushの禁止。以下のファイルをproject配下、 .git/hooks/ の中に入れる
#!/bin/sh
# if the branch is master, then fail.
branch="$(git symbolic-ref HEAD 2>/dev/null)" || \
"$(git describe --contains --all HEAD)"
if [ "${branch##refs/heads/}" = "master" ]; then
echo "Do not commit on the master branch!"
exit 1
fi
#!/bin/sh
# if the branch is master, then fail.
branch="$(git symbolic-ref HEAD 2>/dev/null)" || \
"$(git describe --contains --all HEAD)"
if [ "${branch##refs/heads/}" = "master" ]; then
echo "Do not commit on the master branch!"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment