gitbitbucketpull-requestgit-patch

Apply Bitbucket pull request as a patch


I've got a repo on Bitbucket that only I have write access to.

Someone forked that repo, made changes and issued a pull request to my repo from the fork.

How can I get that pull request as a git patch to apply temporarily to my repo for testing purposes?

The forked repo is private so I can't pull it down, and I wouldn't want to do that anyway.

On GitHub you can simply go to a pull request and add a .patch to the end of the url to download the patch. This doesn't work with Bitbucket.


Solution

  • The Pull Request Patch is available through bitbucket API (despite there is no button to download it directly from the Pull Request page).

    to access the Pull Request patch : https://bitbucket.org/api/2.0/repositories/GROUP/PROJECT/pullrequests/ID/diff

    source: https://jira.atlassian.com/browse/BCLOUD-8323?focusedCommentId=2226612&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-2226612