claude-code - 💡(How to fix) Fix Worktree code review panel diffs against main instead of the worktree's upstream branch [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#48200Fetched 2026-04-15 06:30:19
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1
RAW_BUFFERClick to expand / collapse

Bug

When a worktree is created from a feature branch that diverges from main, the code review panel shows the diff between the worktree branch and main — not between the worktree branch and its upstream/base branch.

Steps to reproduce

  1. Have a feature branch (e.g. tracy/2026-infra-fixes-only) that is behind main by N commits
  2. Open a new task/worktree based on that feature branch
  3. Make no changes
  4. Open the code review panel

Expected behavior

The diff panel shows 0 changed lines (no work has been done).

Actual behavior

The diff panel shows +9514 lines — the entire delta between the feature branch and main.

Impact

The code review feature is completely unusable when working on worktrees based on feature branches. The panel is flooded with unrelated changes, making it impossible to review what Claude actually changed.

Environment

  • The worktree's git upstream is correctly set to the feature branch (branch.<name>.merge points to the feature branch, not main)
  • branch.<name>.vscode-merge-base is also set to the feature branch
  • Claude Code ignores both and diffs against main anyway

extent analysis

TL;DR

The code review panel should be configured to diff against the worktree's upstream/base branch instead of main.

Guidance

  • Verify that the branch.<name>.merge and branch.<name>.vscode-merge-base configurations are correctly set to the feature branch for the worktree.
  • Check if there are any other configuration settings that might be overriding the expected behavior, such as a global or user-level setting that defaults to diffing against main.
  • Consider setting the vscode-merge-base configuration to the feature branch explicitly for the worktree, to ensure that the code review panel uses the correct base for the diff.
  • Investigate if there's an option to configure the code review panel to use the worktree's upstream branch as the base for the diff, rather than relying on the vscode-merge-base setting.

Example

No code snippet is provided as it's not clearly supported by the issue.

Notes

The issue seems to be related to the configuration of the code review panel and the worktree's upstream branch. However, without more information about the specific tooling and configurations used, it's difficult to provide a more detailed solution.

Recommendation

Apply workaround: Configure the code review panel to use the worktree's upstream branch as the base for the diff, if possible, to avoid the incorrect diff against main. This should allow for a usable code review experience when working on worktrees based on feature branches.

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…

FAQ

Expected behavior

The diff panel shows 0 changed lines (no work has been done).

Still need to ship something?

×6

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

Back to top recommendations

TRENDING