It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Difference of refs/pull-requests/<ID>/merge and refs/pull-requests/<ID>/from

When a pull request created, I saw following remote branch created automatically,

  • refs/pull-requests/<ID>/merge
  • refs/pull-requests/<ID>/from

What is the difference of these two?


BTW, I am trying to polling git to check new pull requests and automatically test them (I have no permission to change to Bitbucket server's setting to add a pull request notification plugin).

1 answer

1 accepted

4 votes
Answer accepted


First I want to point out that this is an internal implementation detail, and not part of our API. Anything you build that depends on these files may stop working after an upgrade to Bitbucket Server without warning. A better alternative may be to talk to your System Administrator about installing a plugin.

To answer your question, the "from" ref points to the head of the source branch of the PR. The "merge" ref points to a merge commit between the "from" ref and the head of the target branch. To understand why we track these it might help to read this blog post.

You should note that these refs are not automatically updated when a change is made to the branch. A user must view the PR in their browser for the refs to be updated. You can read this answer to understand why. You cannot rely on these refs being updated in order to pick up changes to the pull request as they happen.

Another option may be to look at our REST API - you can use this endpoint to retrieve all pull requests in a repository. From there, fromRef.latestCommit for each PR in the response will tell you the commit at the head of the source branch, similar to the "from" ref, except the value from the REST API will update automatically. 

Hopefully this helps clarify things.


Isabella - Atlassian

Thank you very much! It is very helpful.


If "pull-request/*/merge" is an internal API that might break at any time, what would be the proper supported way to implement the solution suggested here in order to test the merged code instead of the source branch during PR builds?

Like # people like this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

649 views 0 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you