Skip to content

chore: protect main (branch protection + local pre-push guard) - #14

Merged
emp3thy merged 1 commit into
mainfrom
chore/protect-main
Jul 23, 2026
Merged

chore: protect main (branch protection + local pre-push guard)#14
emp3thy merged 1 commit into
mainfrom
chore/protect-main

Conversation

@emp3thy

@emp3thy emp3thy commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Why

Feature work reached main via a direct admin push. This closes that hole with two layers.

Server-side (already applied to the repo)

GitHub branch protection on main:

  • PR required to merge; admins included (direct pushes blocked for everyone, including admin tokens — the gap that let the earlier push through)
  • Required status check: Claude BugBot review
  • Conversation resolution required before merge
  • No force-pushes, no branch deletion
  • 0 required approvals (solo self-merge stays possible)

Local (this PR)

  • scripts/git-hooks/pre-push — rejects direct pushes to main locally, before the network round-trip, with a message pointing at the branch/PR flow
  • scripts/install-git-hooks.sh — copies tracked hooks into .git/hooks without hijacking core.hooksPath, so graphify's post-commit/post-checkout keep working; run once per clone
  • CLAUDE.md — mandatory branching section + the one-time install step
  • .gitattributes — pins hooks (and *.sh) to LF so the shebang survives the Windows checkout

Emergency bypass is git push --no-verify; the server rule still catches it.

Verified

  • Simulated pre-push: push to main → blocked (exit 1); push to a feature branch → allowed (exit 0)
  • Hook files confirmed i/lf w/lf in index and working tree
  • This PR is itself the first run of the new flow (branch → PR → merge)

🤖 Generated with Claude Code

main is now protected server-side (GitHub branch protection: PR required,
BugBot check, admins included, no force-push/deletion). This adds the local
belt-and-braces: a tracked pre-push hook that rejects direct pushes to main
before the round-trip, an installer that drops it into .git/hooks alongside
graphify's hooks (no core.hooksPath hijack), and CLAUDE.md branching rules.
Hooks pinned to LF so the shebang survives the Windows checkout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Claude BugBot Analysis

No bugs found. This PR adds documentation (CLAUDE.md branching note), a .gitattributes rule enforcing LF line endings for hook scripts, and a local pre-push git hook plus installer script — the hook correctly reads the standard git pre-push stdin protocol (local_ref local_sha remote_ref remote_sha) and blocks pushes where remote_ref matches refs/heads/main, and the installer correctly copies and chmods the hook files.

No bugs were detected in this PR.

@emp3thy
emp3thy merged commit a324828 into main Jul 23, 2026
1 check passed
@emp3thy
emp3thy deleted the chore/protect-main branch July 23, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant