PR comparison widget shows stale diff counter when comparing same branch

Status Fixed / completed
Maintainer reply None cached
Activity 4 comments · opened Feb 12, 2026 · closed Feb 12, 2026

Description

The branch comparison / PR creation widget in the Claude Code input area shows a stale diff counter (+20 -2744) even when:

  • Both sides of the comparison are the same branch (main ← main)
  • The working tree is clean (git status shows no changes)
  • Local and remote are in sync (git diff origin/main..main is empty)
  • There are no other branches in the repository

The counter does not clear after committing, pushing, or restarting the Claude Code session.

Steps to reproduce

  1. Have a repo with a single branch (main), fully pushed, clean working tree
  2. Open Claude Code in the project directory
  3. Observe the main ← main comparison widget showing a non-zero diff counter

Expected behaviour

When comparing the same branch to itself with no uncommitted changes, the counter should show +0 -0 or the widget should be hidden entirely.

Possible cause

The repository was recently renamed from master to main. The counter may be cached from a previous comparison between the two branches before master was deleted. Alternatively, untracked files (even gitignored ones) may have been included in the diff calculation.

Environment

  • Claude Code CLI (Opus 4.6)
  • Windows 11, Git for Windows
  • Single-branch repo, no PRs, no CI/CD

View original on GitHub ↗

4 Comments

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/20478
  2. https://github.com/anthropics/claude-code/issues/24834
  3. https://github.com/anthropics/claude-code/issues/20406

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

Mathias-Xuviate · 8 months ago

https://github.com/anthropics/claude-code/issues/20478 seems to be a similar issue, but it was also closed as duplicate / I would upvote the actual open one

Mathias-Xuviate · 8 months ago

Closing as duplicate of #18541 (diff counter includes read files, not just changed files). That explains the inflated +20 -2744 we see -- Claude read many files during the session that were not actually modified. Upvoted #18541.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.