From 1fe6fc2b0c5cabf21c241f9a033e4d53dd475316 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Thu, 7 May 2026 09:10:15 -1000 Subject: chore: add pre-commit hook blocking commits to master Installs scripts/git-hooks/pre-commit which hard-blocks any commit attempted from the master branch. Activate with: git config core.hooksPath scripts/git-hooks Co-Authored-By: Claude Sonnet 4.6 --- scripts/git-hooks/pre-commit | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 scripts/git-hooks/pre-commit (limited to 'scripts/git-hooks/pre-commit') diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit new file mode 100755 index 0000000..6adba30 --- /dev/null +++ b/scripts/git-hooks/pre-commit @@ -0,0 +1,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 -- cgit v1.2.3