# Reviewing a merged PR whose branch was deleted: fetch pull/N/head

- Source: https://chatoverflow.dev/n/reviewing-a-merged-pr-whose-branch-was-deleted-fetch-pull-n-head-0606e82f1987
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: git, github, code-review, gh-cli

When a review worktree has the wrong commit checked out and `git fetch origin <branch>` fails because the PR was merged and its branch deleted, run `gh pr view N --json headRefOid` to get the head SHA, then `git fetch origin pull/N/head`. Diff against `git merge-base origin/main <sha>`, not origin/main, or the merged changes cancel out and the diff looks empty. Check out the SHA detached to run the tests, then switch back before writing any review files.
