RamaKrishna Chowdary
RamaKrishna Chowdary

Reputation: 15

How can I retrieve all commits from Bitbucket without merge commits?

I found this API for retrieve all commits:

https://bitbucket.mycompany.com/rest/api/1.0/projects/XXXXX/repos/wwwwww/commits/1afdd692dc99eae74c7280306ca97bcb237bbe5f

but the response includes merge commits. I want only original commits. Is there any way to exclude merge commits from the response?

Upvotes: 1

Views: 1425

Answers (1)

Chris
Chris

Reputation: 136909

The Bitbucket Server API documentation shows an optional merges parameter on this endpoint:

if present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits or only, to only return merge commits.

I think something like

https://bitbucket.mycompany.com/rest/api/1.0/projects/XXXXX/repos/wwwwww/commits/?merges=exclude

should do the trick.

Upvotes: 2

Related Questions