Repository navigation
feat(box): new worktrees start from origin's main, and local main keeps up - #160
Merged
Merged
Conversation
…ps up Before a new branch is made from the default branch, berthd fetches it and fast-forwards the local one: a compare-and-swap update-ref when nothing has it checked out, `merge --ff-only` with hooks and merge options off when the main checkout does. A checkout with uncommitted changes, or a main with commits origin doesn't have, is left alone; the branch then starts from origin/main (with no upstream until its first push) or from the local commits. A failed fetch changes nothing. worktree.created reports what it did as "main". On by default; "keep_main": false in any config layer, or the new Main branch section in Project settings, turns it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
This branch was successfully deployed
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.
A new worktree from
mainnow starts from whatoriginhas, not from whenever the box last pulled. This is the same behaviour as Orca's "Keep Local Main Up to Date", but on by default.Before: new branches started from local
mainwith no fetch (git worktree add -b x path main). A main checkout that hadn't been pulled in a week meant every new task started a week behind, andgit diff main...HEADin it compared against old history.Now, before a new branch is made from the default branch, berthd:
origin, with a 20 s timeout. A failed fetch changes nothing and the create carries on.main:mainchecked out, it moves it with a compare-and-swapupdate-ref.merge --ff-onlythere, with hooks, autostash, gc and branch merge options off and--no-overwrite-ignore.origin/mainwith--no-track, so its upstream is set by its first push.mainhas commitsorigindoesn't, it isn't moved, and the new branch starts from those commits.Only creates from the default branch are affected. Existing branches, PRs and other bases are unchanged. Creates in one repo are serialised so two can't race on
index.lock.worktree.createdreports what happened asmain: { branch, status, behind? }.Turning it off:
"keep_main": falsein any config layer (repo, kit or the box's own), or the new Main branch section in Project settings.The docs cover the config key, the event field and the concept page. I also fixed the sync endpoint's docs, which left out the
pullmode. Changelog entry is under Unreleased.Proof
A real, isolated
berthd(ownBERTH_HOME, port 7499) against a throwaway origin and clone:Tests (
internal/box/freshbase_test.go, real git repos):Project settings › Main branch (mock mode,
e2e/keep-main.spec.ts), on by default, then turned off on this box:Checks
go vet ./...passes.go test -race ./...passes exceptTestAttachPassesShiftEnter, which fails the same way onmainwith this Mac's tmux 3.7c, so it comes from that tmux, not from this change.tsc -p e2eall pass.keep-main.spec.tspasses, 2 tests.docs-sitebuilds.🤖 Generated with Claude Code