Worktrees, diffs and pull requests
How T3 Code maps threads to git worktrees so several agents can work in parallel, plus the diff viewer, checkpoints, and the one-click commit to pull request flow.
The chat window is not what makes T3 Code interesting. The git plumbing is.
The problem worktrees solve#
Run two agents in two terminal tabs against one repository and they share a working directory. Agent A edits src/auth.ts while Agent B runs the test suite, and B's tests fail for reasons that have nothing to do with B's task. Add a third and it becomes untenable.
git worktree is the standard fix: one repository, several checked-out working directories, each on its own branch, sharing a single .git object store. T3 Code automates it.
# what you'd otherwise type, per agent, every time
git worktree add ../repo-feature-auth -b feature/auth
cd ../repo-feature-authHow T3 Code maps threads to branches#
Start a thread in a new worktree and the agent does all its work in a separate directory on its own branch. Your main working tree is untouched — you keep editing, keep running the dev server, keep your uncommitted changes.
Practically this means three agents can run at once: one refactoring, one writing tests, one chasing a bug. Each has a clean tree. None of them see each other's half-finished edits.
Recent builds add a worktree indicator on session rows, so you can tell at a glance which thread is operating where — worth checking before you assume a thread is editing your main checkout.
The diff viewer#
Every change the agent makes is reviewable before it becomes a commit. Recent nightlies have put real work into this panel:
- Large diffs collapse by default, so a 2,000-line generated file doesn't bury the three lines you care about
- A collapse-all toggle for the whole panel
- Diff scope switching, for looking at a single change versus everything in the thread
Read the diff. The failure mode with agentic coding isn't dramatic breakage — it's plausible-looking code that quietly does the wrong thing, and the diff view is where you catch it.
Checkpoints#
T3 Code checkpoints work as the agent goes, so a thread has restore points. When an agent goes down a bad path — and it will — you roll back to before the detour instead of untangling twelve files by hand or discarding an hour of good work along with the bad.
This is git underneath, so the usual escape hatches remain available. Nothing traps you inside the GUI.
Commit, push, pull request#
When the agent finishes, the controls in the top right handle the sequence without a terminal:
- Review the diff
- Commit
- Push the branch
- Open the pull request
Recent builds also colour settled PR labels on hover and keep settled threads accessible, so a finished thread stays available for reference rather than disappearing.
A workflow that holds up#
- Start each meaningful task as a thread in a new worktree
- Leave your main checkout alone — that's your working copy, not the agent's
- Let the agent run in Full Access inside its worktree
- Review the diff properly, not by scrolling past it
- Roll back to a checkpoint rather than arguing with the agent about a bad approach
- Commit and open a PR from the UI
- Delete the worktree when merged
The part people skip is 4, and it's the part that determines whether agentic coding is a net gain.
Branch settings and gotchas#
- New threads no longer inherit branch settings from previous threads — a recent fix, since inherited branch state produced surprising commits
- A branch-mismatch banner warns you when a thread's branch doesn't match expectations. It was toned down after being too noisy, but it's still worth reading rather than dismissing
- Worktrees consume disk. A large repo times five active worktrees is real space; prune merged ones
git worktree list # see everything
git worktree prune # clean up removed onesFAQ#
How do git worktrees work in T3 Code?#
Each thread can be assigned its own git worktree — a separate working directory on its own branch, sharing one repository. The agent makes all its changes there, leaving your main checkout untouched.
Can I run multiple agents at once in T3 Code?#
Yes. That's the main reason for worktree support: each thread gets an isolated directory and branch, so several agents can work simultaneously without interfering with each other's files or test runs.
Does T3 Code let me open a pull request without a terminal?#
Yes. After reviewing the diff, controls in the interface handle commit, push and pull request creation as a single flow.
Can I undo what an agent did in T3 Code?#
Yes. T3 Code checkpoints during a thread, so you can roll back to an earlier state. Since it's built on git, you can also use ordinary git commands to recover.