问题描述
我正在尝试通过使用特定存储库的vsts客户端模型来获取GIT的所有提交。我可以通过使用函数GitClient.GetCommitsAsync(...)来获取特定存储库的所有提交,并且我发现返回值是GitCommitRef类的列表
,也有一个属性"Changes"。 GitChange的类型列表包含在GitCommitRef中。但我意识到所有的"改变"都是每个GitCommitRef从返回结果为空,我不知道为什么?
请支持我这个问题。
I'm trying to get all commits from GIT by using client model of vsts for a particular repository. I could get all commits for a particular repository by using the function GitClient.GetCommitsAsync(...) indeed, and I found that the return value is a list of GitCommitRef class,also have a property "Changes" with type list of GitChange was including in GitCommitRef. But I realized that all "Changes" are null for each GitCommitRef from return result, I don't know why?
Please support me with this issue.
推荐答案
我已经测试了网站上的代码片段
https://github.com/Microsoft/vsts-dotnet-samples/blob/master/ClientLibrary/Snippets/Microsoft.TeamServices。 Samples.Client / Git / RepositoriesSample.cs ,但也为GitClient.GetCommitsAsync(...)中的更改获取空值。
I've tested the code snippet from website https://github.com/Microsoft/vsts-dotnet-samples/blob/master/ClientLibrary/Snippets/Microsoft.TeamServices.Samples.Client/Git/RepositoriesSample.cs, but also get null value for changes in GitClient.GetCommitsAsync(...).
我没有使用客户端模型,而是我想建议您使用REST API,这里已经有一个REST API来获取更改项目的提交,请查看以下链接:
Instead of using client model, I'd like to suggest you use REST API, here is already a REST API to get a commit with changed items, please check the link below:
https://www.visualstudio.com/en-us/docs/integrate/api/git/commits#与改变的项
祝你好运,
这篇关于从GIT获取特定存储库的提交更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!