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
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commits
I am using the above endpoint to pull all commits from all projects and I want to be able to link commits to the branch it was made on. But I dont see any reference to the branch, under "parents" object, there is only reference to the parent commit.
Does anyone know where I can find this relationship?
Hello @Mir Aman ,
Welcome to the Community!
While the List commits endpoint doesn't directly return the branches that the commit is part of, we do have a feature request opened to implement the ability to get the branches that contains a commit :
Feel free to add your vote there and mark yourself as a watcher to receive first-hand updates on the implementation of that feature.
A workaround I can think of is to provide the branch name in the List commits endpoint so it will just return the commits for that specific branch, like in the below example :
https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/commits/<branch name>
You could first get the List of branches and then for each branch returned, call the endpoint above to get all the commits contained in that particular branch.
Hope that helps!
Let me know in case you have any questions.
Thank you, @Mir Aman !
Patrik S
I just want to add incase anyone else needs this for future reference, the method suggested by Patrik works, but there is a lot of redundant data, as commits made on the parent branches are included in the child branch. This requires some cleanup after getting the response but otherwise is a good solution.
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.