Git Worktrees & One-Click PRs
Run parallel threads in separate worktree folders and review diffs, commit, push, and open PRs in one UI.
If you have to pick one feature that separates T3 Code from juggling multiple terminal splits, it is built-in Git worktree isolation.
Most engineers skip git worktree in plain shells because creating directories, switching branches, and cleaning them up manually feels tedious. T3 Code builds that lifecycle directly into thread creation and diff review.
1. Current Checkout vs. New Worktree (mod+shift+x)
When opening the workspace picker (mod+shift+x), you generally choose between two modes:
- Current checkout: The agent edits your main repository directory directly. Good for a single quick task when you want immediate live reload in your open editor.
- New worktree: T3 Code creates an isolated directory and a dedicated feature branch (commonly prefixed with
t3code/ort3/) specifically for that thread.
Rule of thumb: The moment you run two or more threads concurrently on one repo—or keep editing manually in your editor—always pick New worktree.
T3 Code also guards shared checkouts: if an agent is actively running inside a shared checkout, it prevents unsafe branch switches and nudges you toward dedicated worktrees.
2. Inspecting Diffs Across Turns
Once a turn finishes, click Open diff. Rather than giving you only one giant flat diff, T3 Code lets you inspect:
- Uncommitted files: All pending edits in the thread's workspace;
- Latest turn: Only what the most recent prompt changed—great for step-by-step verification;
- Specific historical turns: Revisit what a particular earlier turn modified;
- Base branch comparison: Preview the exact diff your reviewers will see on a pull request.
3. Commit, Push, and Open a Pull Request
Right from the thread panel and diff header:
- Commit: Click Commit to let T3 Code draft a concise commit message and commit directly to the thread's branch.
- Push: After committing, the action button transitions to subsequent Git steps—open its dropdown to Push the branch upstream.
- Open Pull Request: Create the PR on GitHub or GitLab without leaving T3 Code. Linked PR badges sync automatically onto the corresponding thread item in your sidebar.
4. Cleaning Up Old Worktrees
If you open several worktrees every day, stale directories pile up quickly. Look for Delete worktrees with deleted threads inside project settings: when enabled, archiving or deleting a finished thread safely prunes its worktree directory.
5. Two Worktree Gotchas
- Untracked
.envfiles are not cloned into worktrees: Git worktrees only check out tracked files. If your tests rely on.gitignored.envfiles or local secrets, copy or symlink them into the worktree as needed. - First-run build caches: A fresh worktree starts without previous build outputs, so the very first test or typecheck run may take slightly longer than subsequent turns.