How to get all commits from all branches via bitbucket REST api 1.0? - rest

I want to get all commit data from all branches via Bitbucket REST api 1.0 like this :
curl -u $id:$password http://$path/rest/api/1.0/projects/$project/repos/$slug/commits
All I get is all commit data from a default branch only, not all branches.
What I want is like this :
curl -u $id:$password http://$path/rest/api/1.0/projects/$project/repos/$slug/commits?branches=all
Of course, it doesn't work. :/
I've already read the official document but I cannot find a clue.
https://docs.atlassian.com/bitbucket-server/rest/6.10.1/bitbucket-rest.html#idp205
I guess, getting all branch list, and then searching all commits at each branch can be possible. It seems annoying because I have 200 projects and almost 4,000 repositories.
I need your help.
Thank you.

I found out there is currently no single endpoint to return all the commits associated with all branches.
There was a suggestion few years ago but it was rejected by the developers.
https://jira.atlassian.com/browse/BSERV-5363
The only way to get all commits across all branches is :
Make an api call for all the /branches
For each branch make an api call for its /commits?until=
Remove duplicate commits, then insert the branch commits by timestamp.

Related

How to get the commits of a branch which is NOT a default branch of a repo?

How to get the commits of branch which are not default?
Currently the search commit api is giving only the commits present on default branch.
I have tried the below things. By adding branch name as a query param but not getting anything.
If I remove that query param I get only default branch (i.e. main) commits.
TRIED This: but not getting any output.
https://api.github.com/search/commits?q=repo:test-dai/issue-test+committer-date:1970-01-01..2023-02-14&branch=demo
https://api.github.com/search/commits?q=repo:test-dai/issue-test+committer-date:1970-01-01..2023-02-14+branch=demo
I want commits of a branch which is NOT a default branch.
You will need to send a request to the /repos/{owner}/{repo}/commits/{branch_name} endpoint. It is a linked list, so you will first see the head.
This question dealt with your problem on GitHub.

Which master is compared in a pull request?

I was looking at the changes in a pull request and found something strange. It appears as though the pull request compares my local version of master with my branch. How is that?
Screenshot of pull request on top and master branch at the bottom:
Welcome to Stackoverflow.
At the top of every pull request, you can see which two branches are being compared.
Look at this image, new-exchange-bitbns is the branch I'm trying to merge into master of forked repo.
Also, you should consider searching,there are many excellent guides out there to help you around github interface.

git - update a fork hosted on an organization

I have fork-ed a project on an organisation I'm part of. I'm trying to get the fork updated as there were commits (see below) just by using the web interface.
I've searched the net but I did not find anything relevant.
How can I do that?
Thanks
As i've never played with someone's branch before, my question sounds stupid but bear in mind : This was my first time.
Please find the way to update the branch you've forked , when that person who own the branch, committed changes and you want your fork to be the same as his branch. All done by Github's web interface
Go to the pull request tab
Click on the button New pull request
Create a pull request
Commit (as you are asking for his changes willingly, you are the one committing :))

How do I pull a specific version of a branch to the master?

This question pertains to my workflow using github. My colleague sent me a pull request and kept advancing the branch he was working in with new commits? I want to pull the commits related to the pull request, but the pull request now has the commits too. I searched for solutions and kept being led to the "rebase" command. Regrettably, that command is too complicated for me, plus I use tortoiseSVN as my interface to github. I had some solutions using revert, but they were all un-elegant and there had to be something easy. Also the last time I tried a revert, I had some conflicts with commits that no longer existed because of the revert.
My colleague got a response from a github "ask a human". I am reporting the solution here to help other users.
Navigate to the branch with the work to be pulled.
Navigate to the commit history for the branch and identify the point in that history that you want to pull into the master.
Click on the button on the right marked "<>" == "Browse the repository at this point in the history".
Click on the branch pull down menu and create a new branch. This will create a new branch at that point in the history that you want to pull into the master.
Create and execute a pull request to merge that branch into the master.
Too easy. I don't understand how I didn't run across an example of this workflow. I hope I save someone else the time and headaches that I spent.

Is it possible to setup github pull requests to use rebase instead of merge?

When I create a pull request on Github, it gives me a nice 'Merge' button on the pull request page. Is it possible to configure this button to do a rebase instead of a merge?
It may be interesting to note, despite the question being ages old, that Github finally added this option!
The whole story is here:
https://github.com/blog/2243-rebase-and-merge-pull-requests
Keep in mind that this option does change your commits, setting the committer to the current user. Also the commit date changes. Thus, the commit hashes change.
No, it always does a git merge --no-ff, and the github website doesn't have access to your local configuration.