Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Is it possible to get a hash of merge commit before merge?


I am trying to get the test merge commit ie.., before merging a pull request it will test the merge to see if any merge conflicts exist or not.  In GitHub its providing a merge_commit_sha (The value of the merge_commit_sha attribute changes depending on the state of the pull request. Before merging a pull request, the merge_commit_sha attribute holds the SHA of the test merge commit. After merging a pull request, the merge_commit_sha attribute changes depending on how you merged the pull request) .


So can we get the same in Bitbucket too or its already there? if its already there then how can I get the test merge commit in bitbucket?


1 answer

1 accepted

0 votes
Answer accepted
Caroline R Atlassian Team Oct 25, 2021

Hi, @kamal_mohammed! Welcome to the community! 

No, this is not possible. Just to give you some context about the reason that this is not possible, a commit contains the description of elements such as the author of the commit, the content of the commit (the list of files + directories that make up this commit), the commit's parents, the timestamp at which the commit is created. The hash of a commit is a hash of all this information. Since it is not possible to guess beforehand the timestamp at which the commit will occur, we cannot guess beforehand what that hash will be.

Please let us know if you have any questions related to this subject so we can help you with that.

Kind regards,

Hi @Caroline R!

Thanks for the Reply. Ok Understood it.

I see that in the Pull request Page it's doing the check or giving diff with respect to base branch's latest commit and telling us about Any Merge Conflicts that may come up. So How is it is checking for Merge Conflicts that are coming up? If done Internally, can you give me an idea of how it is doing so?




Caroline R Atlassian Team Oct 26, 2021

Hi, Kamal

Bitbucket creates a temporary repository and creates a merge in the back end. This way we are able to show you what the final stage of the changes will look like once the merge is completed and if there are any conflicts.

I hope this helps, but do let me know if you have any questions.

Kind regards,

Like kamal_mohammed likes this

Suggest an answer

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

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,263 views 2 9
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