feat: .commit-on-main Opt-out fuer Branch-Schutz

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 08:30:32 +02:00
co-authored by Claude Opus 4.6
parent f86d4c9b7e
commit 8eb8ad3a2c
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -18,9 +18,10 @@ extract_subject() {
# Git-Commit-Pruefungen
if echo "$cmd" | grep -qE '^\s*git\s+commit\b'; then
# Branch-Schutz: kein direkter Commit auf main
# Branch-Schutz: kein direkter Commit auf main (sofern kein Opt-out per Markerdatei)
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
if [ "$branch" = "main" ]; then
repo_root=$(git rev-parse --show-toplevel 2>/dev/null || echo "")
if [ "$branch" = "main" ] && [ ! -f "${repo_root}/.commit-on-main" ]; then
printf '{"continue":false,"stopReason":"BLOCKIERT: Direkter Commit auf main verboten (globale Regel). Bitte zuerst Feature-Branch erstellen: git checkout -b session/YYYY-MM-DD-titel"}\n'
exit 0
fi