GitHub – Easily fetch a remote pull request

A colleague needs some help with some code or you just want to check it out and play with it. Here is what you need to do:

git fetch origin pull/$PR_ID/head:$BRANCH_NAME

where $PR_ID is the pull request ID and $BRANCH_NAME is the name of the branch that you want to create. Then check out the branch:

git checkout $BRANCH_NAME

Read more on the GitHub documentation:

Run the code and make any changes! Happy coding!