Skip to content

[Feature]: Start a thread in an existing worktree (not only current / new) #3796

Description

@Brechard

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I am describing a concrete problem or use case, not just a vague idea.

Area

apps/web

Problem or use case

The workspace selector when starting a thread only offers Current checkout or New worktree. There is no way to start a fresh conversation in a worktree that already exists — whether it was created by t3code, or by JetBrains / plain git worktree add.

Concrete flow: I'm working in worktree A, I want a clean conversation, but I want it to keep operating on worktree A instead of the main checkout or a brand-new worktree.

Proposed solution

Add an "Existing worktrees" group to the workspace selector, listing the project's worktrees. The data already exists — vcs.listRefs annotates each ref with worktreePath from git worktree list --porcelain, so externally-created worktrees appear too. Selecting one binds the thread to it via the existing reuseExistingWorktree path (the same one branch selection already uses) — no new git op, and no server/contract changes.

The active-worktree label also gains the worktree's folder name (Current worktree · <name>) so you can tell which worktree a thread is in.

Why this matters

Worktrees are already central to the workflow, but they can only be created, not reattached to. Being able to pick an existing worktree makes it practical to start a new/clean conversation without abandoning in-progress work in a previous worktree.

Smallest useful scope

Just the desktop workspace Select: an "Existing worktrees" group sourced from vcs.listRefs, reusing the existing reuse-on-select path. No server changes.

Alternatives considered

Existing worktrees can already be reused indirectly by picking their branch in the branch selector (it shows a "worktree" badge). This surfaces them as first-class workspace choices instead, which is much more discoverable.

Risks or tradeoffs

Derived from the branch ref list, so it won't list worktrees whose branch isn't within the first 100 refs, or detached-HEAD worktrees. Those would need a dedicated git worktree list RPC. Refiles the idea from #1094 (closed for staleness with an invite to resubmit against current main), rebased on current main. Related: #3070, #2708, #3697.

Activity

  1. juliusmarminge commented on Jul 20, 2026

    @juliusmarminge
    Member

    Closing as a duplicate of #1047, the canonical request for starting work in an existing worktree. The active implementation is PR #3798; preserve this report's externally-created and existing-T3-worktree cases during validation.

  2. Wiktor102 commented on Aug 23, 2026

    @Wiktor102

    I know this feature already works; however, the remaining issue for me is discoverability. I didn't realize it switches the worktree when I switch branches until I read through #3798.

    I viewed the workspace selector and branch picker as independent controls (they are spaced far apart). The confusing part is the label “Current worktree.” If I have ten worktrees used by different threads, there is no single obvious “current” worktree. The label tells me that this is a worktree, but to know which one the thread will use, I have to look at the branch name.

    I suggest merging these two controls and grouping branches into those having a checked-out worktree and those that don't. Perhaps there could even be an indicator showing if any thread is currently active in that worktree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions