Spa*_*440 5 c# git libgit2sharp
希望有人打电话帮助。首先,我对 git 很陌生,所以如果我在解释我的问题时犯了一些错误,请原谅我。
我想使用 libgit2sharp 使用库将存在的源代码拉到特定的提交。所以如果有历史
我希望能够提取 5 或该列表中的任何其他数字的源代码。任何源都不会被标记,所以我必须使用提交来进行拉取。希望有人可以提供帮助。
我看过https://github.com/libgit2/libgit2sharp/wiki/git-pull但它似乎没有让我传入 sha 或提交 ID。
编辑我的问题以明确我正在使用图书馆。
所以另一个开发者回答了这个问题。我需要做的就是克隆,然后检查我想要重置的提交。这似乎按照我想要的方式工作。
//clone the master
dir = Path.Combine(localPath, "Target");
Directory.CreateDirectory(dir);
Repository.Clone(tfsUri, dir);
//reset master to the base of the branch
using (var localRepo = new Repository(dir))
{
var localCommit = localRepo.Lookup<Commit>(priorCommitId);
Commands.Checkout(localRepo, localCommit);
}
Run Code Online (Sandbox Code Playgroud)
不确定这是否是您的意思@0andriy,但您的评论有点令人困惑。
| 归档时间: |
|
| 查看次数: |
522 次 |
| 最近记录: |