1
我想查看自用戶最後一次從他們的機器推送以來的所有提交。libgit2sharp獲取自上次推送以來的所有提交
using (var repo = new Repository(repositoryDirectory))
{
var c = repo.Lookup<Commit>(shaHashOfCommit);
// Let's only consider the refs that lead to this commit...
var refs = repo.Refs.ReachableFrom(new []{c});
//...and create a filter that will retrieve all the commits...
var cf = new CommitFilter
{
Since = refs, // ...reachable from all those refs...
Until = c // ...until this commit is met
};
var cs = repo.Commits.QueryBy(cf);
foreach (var co in cs)
{
Console.WriteLine("{0}: {1}", co.Id.ToString(7), co.MessageShort);
}
}
我從另一張貼此代碼,但我不知道如何修改它來獲得提交自上次推的日期。