Repository navigation
[Feature]: Choose the default base for new worktrees, including the current branch #27659
Closed
guryanov-a
started this conversation in
Ideas
Replies: 1 comment
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.
Uh oh!
There was an error while loading. Please reload this page.
Before submitting
Area
apps/web (new-thread composer, worktree base branch picker) and server settings
Problem or use case
When the default workspace is New worktree, a new thread's worktree starts from the repository default branch (
origin/HEAD). There is no setting to change that, so the base has to be picked by hand in the "From " chip on every new thread.This hurts most when work is temporarily focused on a long-lived branch that is not the default. Example: the project checkout is on
final-optimizationsand every new thread for the next few days should branch from it, but each new thread showsFrom develop. If you forget to change the chip, the thread's worktree starts from the wrong base, and you usually notice only after the agent has done some work.A fixed per-project branch name helps teams whose base never changes (
devinstead ofmain). It does not help this case, because the branch you are focused on changes every few days or weeks, and the setting would need editing each time.Proposed solution
Make the default base for new worktrees a setting with a few modes, following the same environment → project inheritance as Start from remote:
In every mode, an explicit pick in the branch chip still wins, and Start from remote still applies (
final-optimizations→origin/final-optimizationswhen it exists on the remote).The current-branch mode does not need to be the default. It should just be one of the options.
Why this matters
The current branch is already used as a base elsewhere: worktrees created through the worktree MCP tools without a
baseRefstart from the project's checked-out branch (noted as unchanged in #22750 and #25942). The composer is the only entry point where it is not available, so a thread started by hand and a thread an agent hands off from the same checkout get different bases.Smallest useful scope
If #22750 or #25942 lands, the current-branch mode could be added to it as a special value or a mode selector next to the branch field, instead of a separate setting. The resolution order would become: explicit pick → mode (configured branch / current branch / repository default) → existing fallbacks.
Alternatives considered
dev" case, but the value has to be kept in sync by hand whenever the focus branch changes.origin/HEADlocally. Also changes which branch T3 Code treats as the default for pull requests and diffs (as noted in feat(settings): choose the branch new worktrees start from #22750).Risks or tradeoffs
mainand fail every run in repos without it #16183). Whether they should respect this setting needs a decision.Examples or references
mainand fail every run in repos without it #16183: scheduled tasks that launch a fresh thread always branch frommainContribution
All reactions