Forum Discussion
chamidu_sumanasekara
Nov 08, 2024Copper Contributor
Azure GIT - Looking for a REST API to retrieve commits/PRs between two tags
Hi,
I am looking for a rest API to retrieve a list of commits/PRs between two given tags.
EX;
assume I have one tag named release-202410 from main branch and another tag named release-202411 from dev branch.
I want to get a list of commits happed between the release-202410 and release-202411. basically, the idea is to get the list of new changes in release-202411 commits and PRs wise
workaround would also be fine if there is no out-of-the box feature for this
2 Replies
Sort By
- balasubramanimIron Contributor
To get commits between two tags in Azure DevOps, use the Get Commits Batch API
API Request:
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commitsbatch?api-version=7.1Request Body:
{
"itemVersion": { "versionType": "tag", "version": "release-202411" },
"compareVersion": { "versionType": "tag", "version": "release-202410" }
}This gives a list of commits between release-202410 and release-202411.
For PRs, manually cross-reference commit IDs.