Reputation: 336
What's the best way to determine the total size of a repository (lines of code) on GitHub by commit? For example, say the first commit introduces 1000 lines of code. Starting from that point, after each commit, the total size might change. How can I track this without using the API to grab the commit list and then grab each commit to obtain the additions/deletions list?
I've been using the v3 API to grab the commits list, as mentioned above. This data doesn't contain the additions or deletions, so AFAIK I can't track the size of a repository this way.
In a perfect world, I'd like to do this using the API, and to not have to git clone each repo. Ideally this data would be available for large numbers of repos using the API without needing to store a local copy of the log or something.
Upvotes: 0
Views: 862
Reputation: 67669
If you want to go through the API, you may be interested in the following entry point
GET /repos/:owner/:repo/commits/:sha
It exposes a neat stats
member which gives the number of added and removed lines for the specified commit.
stats: {
total: 16,
additions: 10,
deletions: 6
}
Upvotes: 1