Added hook to prevent pushing to staging and master

This commit is contained in:
2025-02-17 00:24:14 +11:00
parent 675138fcc5
commit 049698100f
2 changed files with 25 additions and 0 deletions

11
.githooks/pre-push Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
protected_branches=("master" "staging")
current_branch=$(git rev-parse --abbrev-ref HEAD)
for branch in "${protected_branches[@]}"; do
if [ "$current_branch" = "$branch" ]; then
echo "Direct pushes to '$branch' are not allowed. Use a pull request instead."
exit 1
fi
done
exit 0