[Feature]: Add git diff mode toggle in the diff panel
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I am describing a concrete problem or use case, not just a vague idea.
Area
apps/web
Problem or use case
The diff panel currently only shows checkpoint-based turn-by-turn diffs (diff between checkpoint[N-1] and checkpoint[N]). There is no way to see a standard git diff — for example, the working tree diff (git diff + git diff --staged) or a branch-to-branch diff (git diff main...HEAD).
This means:
- Changes made outside the agent (manual edits, other tools, IDE refactors) are invisible until a new turn creates a checkpoint.
- There is no PR-style "diff against base branch" view for reviewing the cumulative result of a session.
- When checkpoint capture is incomplete (see #1434), there is no fallback to verify what actually changed on disk.
Proposed solution
Add a toggle in the diff panel header (next to the existing stacked/split and word-wrap toggles) that switches between:
- Turn diffs (current behavior) — checkpoint-to-checkpoint diffs, with per-turn chip selection.
- Git diff — a live
git diff+git diff --stagedof the working tree, or optionally a diff against a configurable base ref (e.g.main,origin/main).
When in git diff mode, the turn chip strip could be hidden or replaced with a branch/ref selector.
Why this matters
- Users who interleave manual edits with agent turns currently lose visibility of their own changes until the next agent turn.
- For PR review workflows, seeing the full diff against a base branch in-app avoids switching to a terminal or GitHub.
- It provides a reliability fallback when checkpoint-based diffs are incomplete (#1434) or unavailable (#318, #217).
Smallest useful scope
A single toggle that switches the diff panel from checkpoint mode to showing the output of git diff HEAD (unstaged + staged changes against the latest commit). No branch selector needed in v1.
Alternatives considered
- Using an external terminal or
git diffmanually — breaks the flow and loses the integrated file tree / syntax-highlighted diff UX. - The existing "All turns" chip shows cumulative checkpoint diffs, but this is still checkpoint-based and misses changes made outside the agent.
Risks or tradeoffs
- Git diff can be large in repos with many uncommitted changes; may need truncation or lazy loading.
- Need to decide refresh strategy (on-demand vs. polling vs. file-watcher) to keep the git diff view current.
- Two diff modes may add UX complexity; clear labeling and sensible defaults are important.
Examples or references
- VS Code Source Control diff view (working tree diff with inline toggle)
- GitHub PR "Files changed" tab (branch diff)
- Related issues: #1434 (checkpoint accuracy), #1472 (manual snapshots), #318 (checkpoint loading stuck)
Contribution
- [x] I would be open to helping implement this.
I implemented this (along with a few other QoL changes) in my fork and I have been very happy with the result.
A list of changes I implemented:
- An icon toggle to switch between git mode and turn/session mode.
- Collabsible per-file diffs, with a button to collapse/expand all(works in both Git and turn/session mode.
- Tightened the UI around file diffs so they take up less vertical space.
Here is what it looks like:
New buttons (red: session/turn <> git toggle, blue: expand/collapse all):
Git worktree mode with expanded files
Same with collapsed files
I have used my fork of t3code on a very large production codebase (>10M C++ lines of code). I have found that in such large codebases, the turn based diffs can take over a minute to update and reflect in the app after a turn has complete, while the git worktree pane updates almost instantly. I have been using this for close to 2 weeks and it has been very nice.
My fork is 100% vibe-coded (gpt 5.4), I did not review any of the changes, so I highly doubt the implementation is mergable as-is, but hopefully this is a constructive addition to the conversation.
I am working on extracting the git diff changes form my fork so that I can share a branch with changes limited to this feature. I attempted to merge upstream/main and hit a ton of conflicts so my implementation may additionally be out-of-date with recent architectural changes.
Here is the commit that implements the above (changes against main from ~2 weeks ago). I will attempt to rebase against upstream and share a draft PR: https://github.com/pingdotgg/t3code/commit/90f58af0fdf8a01bf47f49efbf119b375d2e7a1c
Created a draft PR here: https://github.com/pingdotgg/t3code/pull/1801
It's not small and focused so it will remain as draft for now, I will try to create a minimal PR implementing only the git source change if I can find the time
@itsfrank, shall I pick up? If you don't mind. I already have an implementation of this in my fork which is much more targeted.
@D3OXY of course!