claude-code - 💡(How to fix) Fix [FEATURE] PR list diff stats should use each PR's actual base, not main

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…

Error Message

This is narrower than #51738 (which is about the branch status badge and argues for commit-centric info generally). Both would be welcome — but even without rethinking the metric, computing it against the right base for open PRs would fix the most egregious error.

Root Cause

#31361 and #31362 are on completely different branches with different contents, but show identical totals because both are being measured against main. The diff stat appears next to a PR row, so users read it as "the diff of this PR" — but it's actually the cumulative delta from the branch head all the way back to main, which for a stacked PR includes every parent PR's changes too.

RAW_BUFFERClick to expand / collapse

Problem Statement

In the PR list view (the stacked PR rows shown in the Claude Code UI), each row shows a diff stat like +3,827 −2. The number is computed against main (the repo's default branch), not against each PR's actual base. In a stack of related PRs the numbers become identical or otherwise misleading:

PRBranchShown diff
#31361PROJECT-68525-...+3,827 −2
#31335PROJECT-68523-...Merged
#31342PROJECT-68524-...+4,457 −5
#31362PROJECT-68174-...+3,827 −2

#31361 and #31362 are on completely different branches with different contents, but show identical totals because both are being measured against main. The diff stat appears next to a PR row, so users read it as "the diff of this PR" — but it's actually the cumulative delta from the branch head all the way back to main, which for a stacked PR includes every parent PR's changes too.

Proposed Solution

For open PRs specifically, the base is not ambiguous — GitHub stores it on the PR object. The fix is cheap:

  • Use gh pr view <num> --json baseRefName,additions,deletions (or the equivalent API call) and show the additions/deletions GitHub already computed against the declared base.
  • Stacks then render correctly because each PR's base is its parent branch.

This is narrower than #51738 (which is about the branch status badge and argues for commit-centric info generally). Both would be welcome — but even without rethinking the metric, computing it against the right base for open PRs would fix the most egregious error.

Alternative Solutions

None currently — the displayed number is the only signal in that row.

Use Case Example

  1. Open Claude Code in a repo with a stack of related PRs (e.g. a 4-PR stack).
  2. Bring up the PR list view.
  3. Observe that PRs on totally different branches show identical diff numbers, and that each PR's number includes its parents' changes.
  4. With this fix, each row would show that PR's own contribution against its declared base.

Additional Context

This suggestion is GitHub-specific. A fully general fix would need equivalent base-ref lookups for GitLab, Bitbucket, etc. — out of scope for this issue but worth flagging.

Related: #51738 — branch status badge shows diff-vs-base line count instead of branch content.

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

claude-code - 💡(How to fix) Fix [FEATURE] PR list diff stats should use each PR's actual base, not main