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

Cherry-picking through REST API

Tedis Agolli January 26, 2023

Hello :) 

 

I am trying to use the Bitbucket API to automatically merge some commits forward from old -> new branch. I have set up a webhook that triggers whenever a new commit is pushed to old. I would then like to take that commit and attempt to merge it forward.

I am using this route:

https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/refs/branches

which takes a "target" commit hash. The target is simply a starting point though. If there are other unmerged commits before my target, the branch will contain all of them. I want the branch to only contain the commit I am specifying. Basically, I'd like to cherry-pick a commit hash into a new branch.

Is this possible at all through the REST API? Is there a possible workaround?

 

Thank you in advance!

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 1, 2023

Hi @Tedis Agolli and welcome to the community!

I'm afraid that it is not possible to cherry-pick using our API. We have API endpoints for creating a new commit by uploading a file and for merging pull requests, but not for cherry-picking.

The only workaround I can think of is using the git cherry-pick command in a clone of the repo and then pushing the change to the Bitbucket repo.

Kind regards,
Theodora

Tedis Agolli February 1, 2023

Thanks, Theodora. That's what I ended up going with.

Like Theodora Boudale likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events