claude-code - 💡(How to fix) Fix Session diff stats in sidebar show branch diff, not session diff [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46294Fetched 2026-04-11 06:24:06
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1

The diff stats (+N -M) shown next to each session in the left sidebar are misleading. They display the cumulative git diff --stat of the active branch vs. the base branch (e.g., master...HEAD), not the actual changes made during that specific session.

Root Cause

The diff stats (+N -M) shown next to each session in the left sidebar are misleading. They display the cumulative git diff --stat of the active branch vs. the base branch (e.g., master...HEAD), not the actual changes made during that specific session.

RAW_BUFFERClick to expand / collapse

Description

The diff stats (+N -M) shown next to each session in the left sidebar are misleading. They display the cumulative git diff --stat of the active branch vs. the base branch (e.g., master...HEAD), not the actual changes made during that specific session.

Steps to Reproduce

  1. Open Claude Code on a branch that already has a large diff from master (e.g., +5599 -3)
  2. Start a new session and do something that makes zero code changes (e.g., ask Claude to summarize a URL via web fetch)
  3. Observe the sidebar — the session shows +5599 -3 despite no code being written

Expected Behavior

The diff stats should reflect the changes made within that session (i.e., what Claude actually wrote/deleted during the conversation), not the total branch diff.

Actual Behavior

All sessions opened on the same branch show identical diff numbers (the full branch diff), making it impossible to tell which sessions actually produced code changes and which didn't.

Impact

  • Users can't quickly identify which sessions were productive vs. exploratory
  • The numbers suggest Claude "wrote" thousands of lines in a session where it only answered a question
  • Sessions with different amounts of work appear identical if they share a branch

Environment

  • Claude Code Desktop App (macOS)
  • Model: Claude Opus 4.6 (1M context)

extent analysis

TL;DR

The issue can be addressed by modifying the diff stats calculation to reflect changes made within each session, rather than the cumulative branch diff.

Guidance

  • Identify the current implementation of diff stats calculation in the Claude Code Desktop App and modify it to track changes made during each session separately.
  • Consider using a session-specific diff calculation, such as git diff --stat HEAD~1 or a similar approach, to accurately reflect changes made during each session.
  • Update the sidebar to display the session-specific diff stats instead of the cumulative branch diff.
  • Verify the fix by testing the updated app with multiple sessions on the same branch and checking that the diff stats accurately reflect changes made during each session.

Notes

The exact implementation details may vary depending on the internal workings of the Claude Code Desktop App and the Git integration. The suggested approach assumes that the app has access to the Git repository and can execute Git commands.

Recommendation

Apply a workaround by modifying the diff stats calculation to reflect session-specific changes, as this will provide a more accurate representation of user productivity and session activity.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING