306
votes

How can I download the changes contained in a Github pull request as a unified diff?

3
Normally the PR patch link is sent to the person, who's accepting the PR.kenorb
This isn't implemented in GitLab yet, but I created a feature request so please add your votes to it.colan

3 Answers

545
votes
53
votes

Somewhat related, to let git download pull request 123 and patch it into mylocalbranch locally, run:

git checkout -b mylocalbranch
git pull origin pull/921/head
2
votes

To get the PR changes into your local repo in an staged but uncommitted state, so you can review:

git pull origin pull/123/head --no-commit

And to generate a patch file from that:

git diff --cached > pr123.diff