Interview Prep/Git & GitHub/Remotes, Collaboration and Pull Requests

You want to test a colleague's PR on your machine.

BeginnerScenarioRemotes, Collaboration and Pull Requests
Answer

Situation read → You need the PR's branch locally, even if it comes from a fork.

What I'd do →

  1. gh pr checkout 482.
  2. Without gh: git fetch origin pull/482/head:pr-482 && git switch pr-482.
  3. Run tests and review with real tooling.
  4. Delete the branch afterwards: git branch -D pr-482.

Why → GitHub exposes every PR at refs/pull/<n>/head, regardless of origin.

Interview tip → refs/pull/<n>/merge shows the tentative merge result with the base branch.

All Git & GitHub questions Roadmap: Git & GitHub

More on Remotes, Collaboration and Pull Requests