How can I test a pull request before merging it?

You can checkout the branch (say, feature) where pull request is created.

$ git fetch

# create a new branch 'test-feature' with 'origin/feature' history
$ git checkout -b test-feature origin/feature
# now test here

You can merge master into test-feature branch and test if all is ok!

$ git pull origin master
# test more

There's even the possibility of checking out the "remote branch" directly, no need to create a local branch (git will say you are working on detached HEAD state), so, using Sajib's example:

git fetch origin
git checkout origin/whatever

Tags:

Git

Github