Bitbucket Cloud REST API to list all commit messages between two branches/tags/commits Edited

Hi,

I'm trying to generate a list of commit messages between either two branches or two commits for the purposes of generating release notes as part of our CI/CD pipeline.

Ideally, we want a text version of an output like this

https://bitbucket.org/ged/ruby-pg/branches/compare/default%0Dstable

So is example, this page gives us all the commit messages between the two branches default and stable

I've found this documentation 

https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/diff/%7Bspec%7D

But it is way too verbose for my use case.

 

 

 

 

1 answer

HI Frank,

 https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commits

Is the commits endpoint that should give you the information you're looking for. It is going to return it as JSON. If you're really only interested in the commit messages you can customize the fields that come back. See https://developer.atlassian.com/bitbucket/api/2/reference/meta/partial-response. 

Combining those things, to get the commit messages between a feature branch and the master branch might look something like this:

 https://api.bitbucket.org/2.0/repositories/get/ruby-pg/commits/stable?exclude=stable&fields=values.message,next

Which gives you just the commit message and a link to follow (the API is paginated).

Hi @Christopher Somme,

Thanks for your response! Very handy.. though sometimes I need to compare feature1 with feature2? Is that possible?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

29,191 views 26 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you