summaryrefslogtreecommitdiff
path: root/scripts/git-hooks/pre-commit
blob: 6adba3020226a3a8213a57248840a7a40a6ebc2d (plain)
1
2
3
4
5
6
7
8
#!/bin/sh
# Prevent accidental commits to master. All work goes to main.
branch=$(git symbolic-ref --short HEAD 2>/dev/null)
if [ "$branch" = "master" ]; then
  echo "ERROR: committing to 'master' is not allowed." >&2
  echo "Switch to 'main' first: git checkout main" >&2
  exit 1
fi