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

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.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 06, 2018 in Bitbucket

Do you use Bitbucket Cloud and Jira Cloud? If so, let us know!

Hi Community, I'm Julia and I'm on the Jira Software Cloud marketing team!  We're looking for companies or teams using Bitbucket Cloud and Jira Software Cloud. If your team fits the t...

155 views 6 3
Join discussion

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