Search code examples
.netoctokit

How to get the number of commits between 2 git tags using octokit.net?


I want to be able to get the total number of commits in a github repository between 2 git tags using octokit.net (Github .NET API).

Same as what the compare in github does.


Solution

  • Short answer: not currently.

    Longer answer: The GitHub API exposes the compare view here:

    http://developer.github.com/v3/repos/commits/#compare-two-commits

    So you can call it like this and get the data you need:

    https://api.github.com/repos/octokit/octokit.net/compare/master...my-cool-branch

    If you can wait a little longer, I've started a pull request to officially support this in Octokit.net:

    https://github.com/octokit/octokit.net/pull/428