Here is a sample to get the latest commit in a branch.
IRepository repository = new Repository(@"D:\Code\MYRepoLocation\.git");
foreach (var branch in repository.Branches)
{
var listOfCommits = branch.Commits;
var latestCommit = listOfCommits.First();
}
You could also pick a specific branch by giving its name
var myBranch2Dot0 = repository.Branches["bug2.0"];
Note: These are the branches available locally, and not the one in Remote