The GitHub CLI has a lot of interesting functionalities. If you usually review PR in your local machine, it has a command to switch your local branch to the PR branch, so you can start reviewing it in a few seconds.
Let’s see this with an example. If you want to review this PR (#1497), you can switch to this PR with this command:
gh pr checkout 1497
Where:
- gh is the GitHub CLI command. More info here.
- pr is used to work with the pull requests. More info here.
- checkout is used to check out a pull request in git. More info here.
- 1497 is the pull request number.
Before you start using this command, you need to:
- Install the GitHub CLI.
- Authenticate it, using the
gh auth login
command. - Set the default remote repository to use. E.g.
gh repo set-default GlotPress/GlotPress
.