LibGit2Sharp get all commits since {Hash}

Is it possible to get all commits since a specified commit using LibGit2Sharp?

I’ve tried the following.. but it didn’t work:

  • Including external header library from github using cmake
  • Suggest a Online repositories & project management tool for a project in Asp.net
  • Versioning an assembly info past the UInt16 barrier
  • Prevent connection string from being committed to repository
  • Upload a project to github C# Visual Studio
  • Building Boost dynamically linkable gives linking error?
  • using ( var repo = new Repository( repositoryDirectory ) )
    {
        //Create commit filter.
        var filter = new CommitFilter
        {
            SortBy = CommitSortStrategies.Topological | CommitSortStrategies.Reverse,
            Since = repo.Refs
        };
    
        /*Not Working
        if (shaHashOfCommit.IsNotEmpty())
            filter.Since = shaHashOfCommit;
        */
    
        var commits = repo.Commits.QueryBy( filter );
    }
    

  • git warnings about unable to unlink git objects. How do I resolve this?
  • Adding older history from svn project with git svn
  • How to use git for managing several projects?
  • Gitlist with different repository and different ldap
  • Github: Unable to sync pages directory
  • Lcov: can not collect branch coverage statistics
  • One Solution collect form web for “LibGit2Sharp get all commits since {Hash}”

    The code below should meet your expectations.

    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);
        }       
    }
    
    Git Baby is a git and github fan, let's start git clone.