From 7016b33b39a934d48dbc71540fe30341e6e0efbb Mon Sep 17 00:00:00 2001 From: aleiby Date: Wed, 21 Jan 2026 18:12:34 -0800 Subject: [PATCH] fix(hooks): allow feature branches in contributor workflow (#850) The pre-push hook now detects when an `upstream` remote is configured and allows feature branches for the fork contribution workflow. Previously, the hook blocked all non-main branches, which prevented pushing PR branches to forks. Now the blocking logic checks for an upstream remote - if present, it skips the block and allows the push. The check wraps the blocking logic (rather than early-out) so that any future additions to the hook will still apply to contributor workflows. Fixes #848 Co-authored-by: Claude Opus 4.5 --- .githooks/pre-push | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index 1dd471e0..9002cbe9 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -15,17 +15,22 @@ while read local_ref local_sha remote_ref remote_sha; do # Allowed branches ;; *) - echo "ERROR: Invalid branch for Gas Town agents." - echo "" - echo "Blocked push to: $branch" - echo "" - echo "Allowed branches:" - echo " main - Crew workers push here directly" - echo " polecat/* - Polecat working branches" - echo " beads-sync - Beads synchronization" - echo "" - echo "Do NOT create PRs. Push to main or let Refinery merge polecat work." - exit 1 + # Allow feature branches when contributing to upstream (fork workflow). + # If an 'upstream' remote exists, this is a contribution setup where + # feature branches are needed for PRs. See: #848 + if ! git remote get-url upstream &>/dev/null; then + echo "ERROR: Invalid branch for Gas Town agents." + echo "" + echo "Blocked push to: $branch" + echo "" + echo "Allowed branches:" + echo " main - Crew workers push here directly" + echo " polecat/* - Polecat working branches" + echo " beads-sync - Beads synchronization" + echo "" + echo "Do NOT create PRs. Push to main or let Refinery merge polecat work." + exit 1 + fi ;; esac done