Worktree code review panel diffs against main instead of the worktree's upstream branch

Resolved 💬 2 comments Opened Apr 15, 2026 by tracyobrien Closed May 26, 2026

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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗