TOP ▲
itcore TOP
> TIPS
> git_push_no.php
タグ:git branch push git 特定のブランチへのpushを禁止する。 | itcore 2021年
vi .git/hooks/pre-push
#!/bin/bash
while read local_ref local_sha remote_ref remote_sha
do
branch="${remote_ref##refs/heads/}"
if [ "$branch" = "release" ] || [ "$branch" = "stage" ] || [ "$branch" = "prod" ]; then
echo $branch にはpush出来ません。
exit 1
fi
done
exit 0
chmod +x .git/hooks/pre-push