Bitbucket Cloud: Checking out pull requests locally

Atish Goswami February 27, 2018

Is there a way to pull/fetch pull request on to my local system?

Currently, I have tried to read a lot of forums and founds some solutions none of which works

git fetch origin refs/pull-requests/<pull request number>/from:<new local branch name>

 

git fetch origin pull/3/head

 

Just wanted to know if it possible to fetch the pull request to the local machine for testing on bitbucket.org, or is there a proper workflow in place to archive this requirement? 

 

1 answer

0 votes
lumoura
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 27, 2018

Hi Atish, 

Welcome to Atlassian community :)

 

Are you referring to something like described in the link below?

https://confluence.atlassian.com/bbkb/how-to-locally-fetch-and-checkout-a-pull-request-724402529.html 

Atish Goswami February 27, 2018

Hello @lumoura,

Thanks for the quick reply I have tried that, seems its a very old answer and does not work anymore, moreover, the UI has changed as well.

When I tried to execute the step provided in the URL it gave me permission issues, it seems you need have access to the forked repository as well (READ ACCESS) to fetch down the changes.

Regards,

Atish 

Adam April 18, 2018

@Atish Goswami did you find an answer?

Atish Goswami April 18, 2018

@Adam No not yet.

It seems that bitbucket doesn't have this functionality. 

Regards,

Atish

Adam April 18, 2018

@Atish Goswami many thanks for your reply. I'm coming to the same conclusion.

There seems to be so many conflicting posts around and it's hard to distinguish between people talking about bitbucket cloud and bitbucket server.

Atish Goswami April 18, 2018

@Adam I am currently using a hack for now using bitbucket's API and fetching the pull request as a patch and applying to local:

curl -u <username>:<password> https://api.bitbucket.org/2.0/repositories/<username>/<reponame>/pullrequests/<pull_request_id>/diff -L | git apply -
Chi Fung Wong
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 21, 2018

@Atish GoswamiThanks for your hack! It works!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events