You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.