I am currently working on a small application that should print out commits of a project after a certain scheme. And for that i need to know on what branch a commit was made on.
Is there a way to do so using the Bitbucket API or isnt anything like that implemented in Git?.
Thx in advance for the Answers!
Hey Nils,
Welcome to the community! Thanks for your question.
The way Git it architectured, it is sometimes a difficult or inapplicable question to ask which branch a commit was made on. Git does not try to explicitly store this information.
One thing you could do is use the endpoint
/2.0/repositories/{username}/{repo_slug}/commits/{revision}
found over here to see which commits, starting from the tip of each specified branch, are reachable from that branch. If a commit exists around the tip of a certain branch and is not reachable anywhere else, the commit was likely made on that branch. However, you may find that older commits might exist on other calls to other branches, especially if some branches in your project have been merged.
I played around a bit with the Bitbucket gui and added these Parameters to the API call trough the URL : (?until=refs%2Fheads%2Frelease%2E2018.7.x&merges=include). I am unsure if it works this way but, I guess i doesn't if Bitbucket doesn't store Information like that. There is still the Question on what information do i get in the Response? If this dosent workout i will try the way u mentioned above.
What i forgot to mention is that i get a Response from the API with a bunch of Commits. But i am unsure if they were made on this specific branch or just a bunch of Commits mixed together.
If these question arent explained well enought just ask il try to explain them more clearly.
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.