如何检索属于存储库第一次(初始)提交的文件?
我目前正在使用以下方法找出属于提交一部分的文件(并且有效)。但是,由于该方法需要两个参数,我应该传递什么来获取第一次提交的文件?或者我需要使用另一种方法吗?
repo.Diff.Compare<TreeChanges>(repo.Commits.ElementAt(i).Tree, repo.Commits.ElementAt(i + 1).Tree)
谢谢!
最佳答案
您可以轻松地在初始树和空树之间进行比较以捕获文件:
foreach (TreeEntryChanges change in repo.Diff.Compare<TreeChanges>(null, commit.Tree))
{
Console.WriteLine("\t{0} :\t{1}", change.Status, change.Path);
}
关于c# - Libgit2Sharp : Get files associated with the initial (first) commit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41600824/