DEV Community

Aashutosh Poudel
Aashutosh Poudel

Posted on

Test upstream PR changes locally [Github]

Steps to bring the changes made in a pull request into your local machine:

  • Find the id of pull request you want to test (say it is #2361) as well as the name of source branch in the pull request (say it is renovate/prisma-monorepo) PR id and branch name
  • When working on a fork of a upstream repo, git remote -v may look like this:

    origin  git@github.com:atosh502/chapter.git (fetch)
    origin  git@github.com:atosh502/chapter.git (push)
    upstream        https://github.com/freeCodeCamp/chapter.git (fetch)
    upstream        https://github.com/freeCodeCamp/chapter.git (push)
    
  • The PR is likely made against a branch(destination: main) in the upstream repo. In order to get the branch(source: renovate/prisma-monorepo) containing the changes for PR to the local repo use the following:

    # git fetch origin pull/<ID>/head:<BRANCH_NAME>
    git fetch upstream pull/2361/head:renovate/prisma-monorepo
    
  • After this the upstream branch from PR will be available as a local branch and we can test the changes.

Resources

Top comments (0)