git checkout PR

How to checkout a git pull request using step-by-step instructions.

Get your pr number

You PR number is : 19

Checkout your PR change to local

There are two ways to checkout a PR change

Use git

Fetch pr to local pr branch

1
2
git fetch origin pull/19/head:local-test-pr-branch

Checkout the local pr branch

1
git checkout -b local-test-pr-branch

Use Github Cli

1
gh pr checkout 19

full usage:

1
gh pr checkout {<number> | <url> | <branch>} [flags]

Github Cli Doc