I'm trying to download all commits for a project using the GitHub API. I'm currently attempting to get all commits via branches and via pull requests:
I read all commits returned by the commit API method (e.g., api.github.com/repos/mojombo/grit/commits). I take pagination into account.
For each branch as returned by the API (e.g., api.github.com/repos/mojombo/grit/branches), I read all commits (e.g., api.github.com/repos/mojombo/grit/commits?sha=5608567286e64a1c55c5e7fcd415364e04f8986e).
For each pull request as returned by the API (e.g., api.github.com/repos/mojombo/grit/pulls?state=all), I also read all commits (e.g., api.github.com/repos/mojombo/grit/pulls/186/commits).
However, when I combine the commits retrieved through these methods, there are still some commits missing. For example, this one https://api.github.com/repos/mojombo/grit/commits/429c045f8313c7734bbb7ae8762edb61f9edcc9a doesn't appear to be associated with any branch or pull request. How can I ensure that I get all commits associated with a project?
I guess you could get all commits by the method mentioned by this doc:
https://developer.github.com/v3/repos/commits/
If you're trying to retrieve a large ammount of commits, you can check the
since
anduntil
parameters