Skip to content

Support configured trunks and worktree branch updates#21

Open
princejoogie wants to merge 4 commits into
kitlangton:mainfrom
princejoogie:pj/configurable-trunks
Open

Support configured trunks and worktree branch updates#21
princejoogie wants to merge 4 commits into
kitlangton:mainfrom
princejoogie:pj/configurable-trunks

Conversation

@princejoogie

@princejoogie princejoogie commented Jun 25, 2026

Copy link
Copy Markdown

Summary

  • Add repo/env-configured trunk branch names while preserving the built-in defaults (dev, main, master).
  • Document stack.trunk and STACK_TRUNKS trunk additions.
  • Make branch updates work when the branch is checked out in a linked worktree by resetting the clean owning worktree instead of force-moving it from another worktree.
  • Push changed stack parent branches during stack sync --apply before repairing descendants, so parent PR heads and descendant PR heads all publish the same propagated commits.

Testing

  • bun run format:check
  • bun run typecheck
  • bun run test -- tests/cli.test.ts
  • bun run test -- tests/stack.test.ts --testNamePattern "sync rebases a branch checked out in another worktree" --testTimeout 60000
  • bun run test -- tests/stack.test.ts --testNamePattern "sync pushes a changed parent before rebasing descendants" --testTimeout 60000
  • bun run test -- --testTimeout 60000

Manual Verification

Created private princejoogie/git-dummy PR stacks and verified tmp.txt add/remove propagation with live GitHub PR metadata:

  • Non-worktree stack: confirmed old behavior pushed descendants but left root stale; after this fix, stack sync --apply pushes root, rebases child/grandchild, and all remote branches contain the propagated commits.
  • Linked-worktree stack: confirmed the same stale-root behavior before the fix; after this fix, root, child, and grandchild remotes all move correctly while child/grandchild are checked out in linked worktrees.

@kitlangton

Copy link
Copy Markdown
Owner

Thanks for this @princejoogie! Heads up on some overlap: the configurable-trunk piece of this PR has now landed separately in #11 (git config stack.trunks), which merged to main. That portion here will conflict.

Could you rebase this PR onto the latest main and pare it down to just the worktree branch updates — i.e. drop the trunk config + docs changes, keeping the repairExecution/Git/Stack worktree-push work?

One more coordination note: #19 (feat/worktree-aware-repair) is a dedicated, more thorough take on repairing branches checked out in other worktrees (dirty-state detection, fail-before-mutation semantics). I'm leaning toward landing #19 as the canonical worktree-repair implementation, so it'd be worth reconciling against it — your remaining delta may be the "push changed parent before repairing descendants" part, which looks complementary rather than overlapping. Happy to help figure out the seam.

@kitlangton

Copy link
Copy Markdown
Owner

Update: both pillars this PR touched have now landed on main separately, so the picture is clearer for a rebase:

Could you rebase onto the latest main and check what's left? My read is your remaining unique delta is the "push the changed parent branch before repairing descendants" behavior during stack sync --apply, so parent and descendant PR heads publish the same propagated commits. That part looks complementary to #19 rather than overlapping.

If that's the case, a slimmed-down PR doing just that — ideally with a focused test like your manual tmp.txt propagation check — would be easy to review and land. Thanks for your patience here, and sorry for the churn; the overlap only became obvious once these were split apart.

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.

2 participants