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:
- Open git bash and ensure your working directory is clean by running
- 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-nameif you were testing Pull Request number 123 from branch called branch-name.
- 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.
- When you are done checking out their work, use
git checkout masterto return to your local version of the source code.