是否可以使用 Visual Studio Team Service REST API 以某种方式设置 Git 存储库的默认分支?有一个 API for repositories和一个用于设置默认分支的 UI,但我找不到通过 REST API 设置默认分支的可能性。
最佳答案
API 可以在这里找到:Update repository
调用:
PATCH https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}?api-version=5.1
有效载荷:
{
"defaultBranch": "refs/heads/{branchName}"
}
关于git - 使用 REST API 设置默认分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34343027/