Skip to content

Testing a Pull Request

Eric Watson edited this page Apr 19, 2014 · 2 revisions

We like to make pull requests for non-trivial changes. This gives folks a chance to review code for quality, and to test changes in their environment. You can review code on Github, or pull it down to your local machine. For testing, you have to pull the code. Here's how.

These instructions will provide a general guide, but some details may differ, depending on your setup.

Let's imagine you want to check out the changes I made on a branch called download. In your local setup, the shoes/shoes4 repository is called origin. If your local repository has a different name for the remote repository, like upstream, adjust the instructions accordingly.

Before you begin, it's always a good idea to make sure your repository is up-to-date with the main repository

git checkout master
git fetch origin
git merge origin/master

When the branch in the main repository

Just checkout a new branch to track the origin/download branch

git checkout -b download origin/download

When the branch is on a collaborator's fork

Let's say your collaborator's Github handle is @KCErb. You'll checkout an new branch based on master, then pull @KCErb's changes into that branch.

git checkout -b KCErb-download master
git pull git@github.com:KCErb/shoes4.git download

Instead, if you want to, you can set up a remote for your collaborator's fork

git remote add KCErb git@github.com:KCErb/shoes4.git

Now (and for future pull requests), you can treat your collaborator's repository like the main one

git fetch KCErb
git checkout -b KCErb-download KCErb/download

Happy Hacking!