0

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.

1 Answer 1

1

If you want to go through the API, you may be interested in the following entry point

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 } 
Sign up to request clarification or add additional context in comments.

2 Comments

I appreciate the response, but unfortunately as mentioned in the question, this is what I want to avoid. On larger repos, this means one API call for every commit. (This might be the only way to do it through the API, which would make me sad!)
Unfortunately, the API only exposes this way to retrieve this kind of data. The Stats API only returns aggregated information.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.