Бывает, что нужно держать приватную ветку.. и чтобы обезопасить себя от случайного жмяка на Publish Branch, имеет смысл запретить её публикацию. Под виндой делается так…
В папке .git/hooks делаем файл pre-push (без расширения) и кладем туда
#!/bin/sh
# List of branches to protect
PROTECTED_BRANCHES="local-branch-name"
# Get the name of the branch being pushed
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/,,')
# Check if the current branch is in the list of protected branches
if echo "$PROTECTED_BRANCHES" | grep -w "$current_branch" > /dev/null; then
echo "Pushing to branch '$current_branch' is not allowed."
exit 1
fi
