gh pr checkout

Fetch a pull request's branch and switch to it

What it does

gh pr checkout 42 fetches the branch of pull request 42, creates a matching local branch and switches to it. You do not need to find out what the branch is called or where it lives: it works for PRs from other people's forks too.

This is how you check a PR before reviewing it: run the tests, try the app. Getting back to your own work is a plain git switch <branch>.

Syntax

gh pr checkout <number>

Examples

Related commands

Practise · All commands