OneBite.Dev - Coding blog in a bite size

Checkout remote pull request on Github and run locally

If you need to review someones pull request from Github and run the project locally. Check out this guide

If you need to review someones pull request from Github and run the project locally. Check out this guide.

For general method, to fetch any remote changes, please see How to test PR locally

Now, we’ll see the step by step to checkout a certain pull request, so we can run it on our machine!

Get the PR number

  1. Either by looking directly on Pull request’s tab on Github. To see the number (that comes after the hashtag)
  2. Alternative, install github-cli command. And run
gh pr list

This command with show all pull request

Fetch the pull request

We can fetch the pull request by running

git fetch origin pull/66/head:new-branch-name

On that sample:
66 -> is your PR’s number new-branch-name -> new branch name you want to use locally

Checkout to that PR!

Now is reviewing time! Checkout to that local branch from PR.. done!

git checkout new-branch-name

Again, “new-branch-name” is your choosen branch from previous step

git