Repository navigation
docs: stop the workflow from forking local main - #661
Merged
Merged
Conversation
CLAUDE.md told agents to fast-forward worktree branches into local `main` so the user could test. PRs are squash-merged, so the branch commit that lands on `origin/main` has a *different* SHA than the one now sitting on local `main` — and that single commit blocks `git merge --ff-only origin/main` permanently, leaving a manual `git reset --hard origin/main` as the only way out. The reflog shows the loop it produced: 12 such fast-forwards against 8 manual resets, with three of them in one session today, each needing the user to stop and decide. The permission is removed: never commit to `main`, never merge a worktree branch into it, and point the user at the worktree to test. The "ff refused" step now says how to tell a stale squash duplicate (identical tree, squashed commit already an ancestor) from live work before anyone reaches for a reset, instead of assuming the latter — today that assumption was wrong, and the commit was a parallel session's unpushed work. Also corrects the documented worktree path (`.claude/worktrees/` is empty; the real root is `.worktrees/`), which nothing caught because both are gitignored, and records that other sessions work in this repo concurrently: stay in your own worktree, and report a commit on `main` you did not make rather than cleaning it up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The local
mainbranch kept ending up unable to fast-forward toorigin/main, and CLAUDE.md was the cause. This fixes the process; it is docs-only.Root cause: the workflow doc told agents to do it
L29 was well-intentioned — let the user test on
main— but the mechanism is broken by design:Evidence: it is a loop, not an incident
git reflog main:Three of those appeared in a single session today, each one requiring the user to stop and adjudicate. Today's specific refusal was not a duplicate at all: it was a parallel session's unpushed work (
8d96b076onclaude/mobile-perf-energy, with uncommitted changes in that live worktree), while the doc told agents to conclude "the user has local commits".Changes
main, never merge a worktree branch into it; to let the user test, point them at the worktree; to land a change, let the PR squash-merge and fast-forward fromorigin/main. The reason (SHA mismatch) and the observed cost are stated inline so the rule does not read as arbitrary.origin/main) from live work, and to ask before any reset. Live work is reported (commit, branch, unpushed), never rebased or reset..claude/worktrees/(empty directory) →.worktrees/. Nothing caught this because.gitignoreignores both, so the wrong path silently worked.mainyou did not make instead of cleaning it up.Verification
make check-docs(both modes) passes — 164 docs OK;CLAUDE.mdis a root-level doc the gate deliberately excludes from bilingual pairing.