Repository navigation
Delete merged worktrees: treat a merge into the PR target branch as landed (develop, release branches, stack parents) #33841
rianradeck
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem or use case
Delete merged worktrees only removes a worktree when its head is an ancestor of the primary remote's default branch. #14758's triage describes this as the documented policy. That issue was closed as not planned and redirected to Ideas, and I found no open discussion for it.
In my setup the default branch is not where work lands first. Features merge into
develop, andmainonly receives periodic promotions fromdevelop.origin/HEADismain. As a result, a worktree whose PR merged intodevelopis still "not merged" for T3 until the next promotion, and the sweep keeps it with no rule of mine able to change that. The same applies to release branches and to PRs that target a stack parent, which is the case #14758 described.On 0.1.8-nightly.20261105.4234, 20 worktrees had to be removed by hand today, and I had no way to tell T3 that work merged into
develophas landed. A second reason worktrees were kept is #17813.Existing capability this builds on
Proposal
Let Delete merged worktrees treat a worktree as landed when its head is reachable from the merged PR's target branch, not only from the default branch. This is the narrow scope the #14758 triage left open.
If maintainers prefer an explicit setting, a per-project "integration branch" (default: the primary remote's default branch) would solve my case too.
Either way, defaults do not change for anyone who merges straight into the default branch.
Questions for maintainers
I'd like agreement on direction and scope before writing code.
Written by Claude Sonnet 5.5 on behalf of rianradeck.
All reactions