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

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

BitBucket Cloud API confirm if commit id in branch


I'm trying to find out if a commit is within a branch. I thought I could filter the commits in a branch eg

returns a response with the "hash" that I thought I could filter on.

values: [
    "rendered": {

    "hash": "fed8b7a890fb2dafb7eb7d44bd11d2e7efb36fa3",

So based on sort and filter doc I should be able to do this.

However this gives exactly the same response ie seems filter not applied.

Also tried

without success.

Seems the only approach is to page through all commits for a branch and search within each page response for that commit?


1 answer

1 accepted

0 votes
Answer accepted
seanaty Atlassian Team Mar 17, 2021

@izalcomax The commits API is a little bit special and not filterable using `q=`. That said there are a few handy URL params for include/excluding commits.

Compare these,values.message,values.message&include=a225c3e87f897167550469144cdff0631f3995d0

If you enter a commit has that's not reachable on that branch then you get a message like:

"data": {
"shas": [
"type": "error",
"error": {
"message": "Commit not found",
"data": {
"shas": [

 See more examples here:

Suggest an answer

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

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,927 views 10 16
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