How to locally fetch and checkout a pull request

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Purpose

A user may want to locally fetch a Pull Request from Bitbucket Cloud, and check it out to test it out first before deciding to merge it. But what is the URL of the Pull Request? Here's a way to do it.

My original repository: sorcerial

My forked repository: sorcerial-fork

Solution

Step 1: Get the URL of the Merge request. For my case, it's https://bitbucket.org/gideon_koh/sorcerial-fork/branch/master :

Step 2: Enter into your local repository (mine is "sorcerial") via command line. Modify the URL a little into the format of git fetch <forked_repo_url> <branch> :


In fact, you can even check the diff between sorcerial/master and sorcerial-fork/master (which is now the FETCH_HEAD) by running the command - git diff master FETCH_HEAD:

(Please do take note that FETCH_HEAD is temporary and will most likely change when another git fetch/pull or some other operations is done.)

Step 3: If you want to check the Pull Request out, to experiment on it and to test it out first, simply run the command - git checkout FETCH_HEAD:


Step 4: And when you finally decided to merge the Pull Request, click the Merge button on Bitbucket Cloud

DescriptionA user may want to locally fetch a Pull Request from Bitbucket Cloud, and check it out to test it out first before deciding to merge it. But what is the URL of the Pull Request? Here's a way to do it.
ProductBitbucket
PlatformCloud
Last modified on Oct 16, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.