How about using LINQ Take
var commits = repo.Commits.QueryBy(new LibGit2Sharp.CommitFilter{ Since = repo.Refs });
foreach (LibGit2Sharp.Commit commit in commits.Take(100))
{
}
Checking the CommitCollection code it seems that it will really only return 100 commits (so it does not look for everything, and then takes 100).
And you can set the desired sort order using the property Filter.SortBy.
source
share