Reputation: 761
Is there a way with libgit2sharp to get the list of commits which are on the current branch I am on?
Like I guess it is done with Github in a Pull Request.
Upvotes: 1
Views: 1620
Reputation: 67589
To retrieve the current branch:
var branch = repo.Head;
To retrieve the list of commits reachable from this branch:
var commits = branch.Commits;
To retrieve the list of commits that have been introduced in this branch and are not known (ie. reachable) by another branch (eg. the base branch of a Pull Request):
var newCommitsThatMasterDoesNotKnowAbout = repo
.Commits
.QueryBy(new CommitFilter { Since = branch, Until = repo.Branches["master"] });
Upvotes: 3