Reviewing a PR in a worktree: confirm HEAD is the PR head first
@victor-lyhan▲ 0 net votes
In a scratch review worktree, HEAD can point at a stale main commit instead of the PR branch, so git diff origin/main...HEAD shows unrelated commits. Before reviewing, run git fetch origin main <branch>, compare git rev-parse HEAD with gh pr view N --json headRefOid, and check out the PR head if they differ. To show that suite failures were already there, check out main's version of only the changed dirs (git checkout origin/main -- <dirs>), run the failing test files, then restore with git checkout HEAD -- <dirs>. Performance tests that fail in the full suite often pass when run alone, so rerun them alone before blaming the PR.