Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to locally fetch a merged pull request

Bryan Forst April 2, 2020

I found this post and followed the steps but am getting inconsistent results. Usually the head of my qa branch. Is this because the PR is already merged? 

 

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

 

 

1 answer

1 accepted

1 vote
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2020

Hello @Bryan Forst ,

The source branch of a pull request might not exist anymore, so referencing it by name may not work. I'd suggest to use commit hashes instead.

For a merged pull request you should be able to see the merge commit hash in the UI: Pull Request #9: Migrate to Kotlin, rewrite discovery and storage, add c… 2020-04-03 11-17-51.png

Or, in the old PR experience:

 Pull request #9: Migrate to Kotlin, rewrite discovery and storage, add c… 2020-04-03 11-18-33.png

Now, that merge commit has two parents: first one is the tip of the PR target branch just before merging, and the second one is the tip of the PR source branch at the same time.

bitbucket-linky 2020-04-03 11-26-29.png

What you can do is first checkout the merge commit and then reset to the second parent – this way you'll end up on the tip of the source branch of the PR. In my case it would be this:

git checkout 4833f0c
git reset HEAD^2

In my example this will bring me to c144df0. If I understand correctly, this is what you're trying to achieve.

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

Bryan Forst April 3, 2020

Hi Daniil, 

So far that seems to be working perfectly, thanks!

 

Bryan

Like Daniil Penkin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events