How to Test a Pull Request

When someone creates a pull request, it’s your responsibility to either accept the changes and merge it to your repository, or reject the changes and close the pull request. These days, Continuous Integration Development involves automation engines like Jenkins or TeamCity that monitor your source repository and can trigger builds for pull requests to ensure the resulting merge will run. However, it is a good idea to test the pull request locally.


To test pull request code locally follow these steps:

  1. Open git bash and ensure your working directory is clean by running git status
  2. get a copy of the PR by typing git fetch upstream pull/<id>/head:<branch>. for example you would type git fetch upstream pull/123/head:branch-name if you were testing Pull Request number 123 from branch called branch-name.
  3. Now that you have a copy of the branch, switch to it using git checkout branch-name. Your directory will now be an exact copy of the PR. Be sure to tell the author about any bugs or suggestions, as you cannot add your own changes to a pull request directly.
  4. When you are done checking out their work, use git checkout master to return to your local version of the source code.

Author: Dev

Full Stack Developer at one of the largest Banks in Canada.