Download Github pull request as unified diff

前端 未结 3 1356
眼角桃花
眼角桃花 2020-12-12 08:54

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

相关标签:
3条回答
  • 2020-12-12 09:16

    To view a commit as a diff/patch file, just add .diff or .patch to the end of the URL, for example:

    • https://github.com/weppos/whois/pull/90
    • https://github.com/weppos/whois/pull/90.diff
    • https://github.com/weppos/whois/pull/90.patch
    0 讨论(0)
  • 2020-12-12 09:16

    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    
    
    0 讨论(0)
  • 2020-12-12 09:25

    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
    
    0 讨论(0)
提交回复
热议问题