Fetch the Bitbucket Pull Request to local repository

Hello,

I would like to fetch the pull request from my Bitbucket project (private repository) to my local git repository to be able to do some tests before merge etc.

So I have tried (according to docs and this QA forum) this request:

$ git fetch origin pull/3/head


However - what can I do when I get those messages:

fatal: Couldn't find remote ref pull/3/head
fatal: The remote end hung up unexpectedly

2 answers

1 accepted

Accepted Answer
0 votes

This feature is not supported at this time. It would be reasonable to compare the branches using this suggestion: http://stackoverflow.com/questions/822811/showing-which-files-have-changed-between-git-branches

Hello, thanks a lot for your answer. Yes, I am able to diff the branches; however it is quite strange for more complicated pull requests and bigger projects from my point of view.

The following worked for me, for checking out a pull request locally:

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

From there, you can do tests, merge this branch into another branch, etc.

Exactly what I needed. Just checkout the new local branch and voila

Thanks

Not working for me,  I see this error:

$ git fetch origin refs/pull-requests/1/from:test 

fatal: Couldn't find remote ref refs/pull-requests/1/from

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

2,390 views 9 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you