blob: 22e876addfcb8c633693155208f4adc76bf00f6c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
# Reject a commit directly to a branch named 'master' if a branch named
# 'develop' exists
# Allow commit if it's not to master
[ "$(git rev-parse --abbrev-ref HEAD)" = master ] || exit 0
# Allow commit if there's no develop branch
git show-ref --quiet --verify refs/heads/develop || exit 0
# Throw toys
printf >&2 'Branch develop exists, commits to master blocked\n'
exit 1
|