pre-push rejects any push that would update refs/heads/main, however the command is spelled; pre-commit and pre-merge-commit refuse commits while main is checked out. npm install enables them via core.hooksPath. The README documents the three layers of protection for main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 lines
265 B
Bash
Executable File
8 lines
265 B
Bash
Executable File
#!/bin/sh
|
|
# Refuse commits (and, via pre-merge-commit, merge commits) while main is checked out.
|
|
if [ "$(git symbolic-ref --short -q HEAD)" = "main" ]; then
|
|
echo "$(basename "$0"): committing on main is not allowed; create a branch first." >&2
|
|
exit 1
|
|
fi
|
|
exit 0
|