Repository navigation
Move a worktree thread (and its changes) to the current checkout #16570
EduardoDadalt
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
T3 Code makes it easy to start work in a worktree, and agents can hand a thread from the
current checkout into a new worktree (
t3_worktree_handoff). There is no way back.When work started in a worktree should continue in the project's own folder (to run the
real dev environment, use a tool that is only set up there, or just stop juggling a
second checkout), today you have to do it by hand:
Step 4 has no manual workaround: the thread stays bound to the worktree.
Proposal
A thread action, Move to current checkout, available for idle threads that work in
a worktree (sidebar right-click menu and the chat header's thread menu on web/desktop).
It:
worktree was detached), so commits made in the worktree come along;
files — as ordinary unstaged edits;
worktreePath: null), so the next turnruns there;
Files ignored by Git (
.env,node_modules) are not moved, and the dialog says so.Never overwrite local work
picks Commit (with a message), Stash, or Discard in the dialog.
before anything changes, so a failure can't lose the work being moved.
git read-tree -m -u, which refuses to overwrite files thatdiffer from what it expects.
metadata update), leaving the worktree on its branch with its changes and the
checkout on its original branch.
same worktree.
Shape
git.moveThreadToLocalCheckoutRPC), so the samecapability could later be exposed as an MCP tool, the reverse of
t3_worktree_handoff.if wanted.
I have a working implementation with tests against real Git repositories (full move,
dirty-checkout refusal, stash, rollback on failure) and would be happy to open a PR if
the direction and scope sound right.
Questions for maintainers
existing worktree cleanup to handle?
move simply refuse and let the user clean up first?
All reactions