12 lines
314 B
Bash
12 lines
314 B
Bash
#!/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
|