我有TFS服务器上的Git仓库,并使用Web API我试图获得两个标签之间发生的提交列表。 与CLI类似的方式:
git log TAG_1..TAG_2但我需要一个Web API。 请帮忙。
I have Git repositories on TFS server, and using web API I am trying to get a list of commits that happen between two tags. Similar way that you can do with CLI:
git log TAG_1..TAG_2but I need this in a web API. please help.
最满意答案
您可以使用此REST API获取2个标记之间的提交: https : //www.visualstudio.com/fr-fr/docs/integrate/api/git/commits#between-two-versions
这里是一个例子:
POST http://servername:8080/tfs/DefaultCollection/_apis/git/repositories/049d1cfa-a972-405f-923b-fe84c21474e6/commitsBatch?api-version=1.0 Content-Type: application/json { "itemVersion": { "versionType": "tag", "version": "v1.0" }, "compareVersion": { "versionType": "tag", "version": "v3.0" } }注意:确保提交和标签已经推入TFS。
You could use this REST API to get commits between 2 tags:https://www.visualstudio.com/fr-fr/docs/integrate/api/git/commits#between-two-versions
Here is an example:
POST http://servername:8080/tfs/DefaultCollection/_apis/git/repositories/049d1cfa-a972-405f-923b-fe84c21474e6/commitsBatch?api-version=1.0 Content-Type: application/json { "itemVersion": { "versionType": "tag", "version": "v1.0" }, "compareVersion": { "versionType": "tag", "version": "v3.0" } }Note: Make sure those commits and tags have already pushed into TFS.
更多推荐
发布评论