4

Doing some automation for our dev team and wanted to know if its possible to find the difference between two branches in bitbucket using the rest API. I know there is a rest endpoint for diff but I am not able to get it to work.

jtkSource
  • 675
  • 9
  • 21

2 Answers2

0

First of all it depends on whether you are using Bitbucket Cloud or Bitbucket Server as those are two separate products and have separate APIs.

For Bitbucket Cloud I believe you can use something like this:

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

For more information refer to this community page. Note that I have not tested the API myself.

As for Bitbucket Server, I have yet to find an equivalent. If anyone finds out please share!

abourg28
  • 575
  • 2
  • 5
  • 10
0

It depends what do you want to compare. Maybe you can try this:

https://api.bitbucket.org/2.0/repositories/WORKSPACENAME/REPONAME/commits/?include=dev&exclude=main

This API call can compare the different commit between branch dev and main

Jonny
  • 1
  • 1