Measure growth rate in size/MB for a git repository?
Asked Answered
T

1

6

I have a git repo a couple of months old. Is it possible to compute/plot the size in MB of the internal git repository (compressed size) as a function of commits (or date for that matter) pushed to the remote?

Since branches can be developed in parallel a given commit might not reflect changes being pushed to another branch.

So having a CI job that runs a git pull each day followed by: https://git-scm.com/docs/git-count-objects

and stores the result in a db might be a way to do this. This assumes that the CI job is activated the same day the repository is created.

Could be great if it was possible to compute this information going back in time on already existing repositories.

I understand that using commits does not really make sense. I would like some way of seeing how it increases in size as some function of time, like they do here: http://blogs.wandisco.com/2013/08/23/git-repository-metrics/

Turnbuckle answered 12/11, 2015 at 13:1 Comment(7)
Have you tried git count-objects -v ?Statist
That gives the current size of the repo. I would like to be able to compute that size for each commit going back in time - I tried running it on an older commit and it gave the same result.Turnbuckle
@Turnbuckle just wondering.... why do you need this? Git repo depth history usually is not the issue. Out git repo with ~70k commits takes ~200MB.Pyoid
git does not work this way. it has nothing to do with number of commit or content. git use heuristics to "shrink" the data size so you cane have similar files with share content and the content will not be duplicated, Its not relevant to measure git size on a commit basics.Lint
you can read more about the heuristics here:github.com/git/git/blob/master/Documentation/technical/…Lint
@codeWizard IMO that should be an answer and not a comment. If the "problem" is not applicable that's something to be fixed in an answer and not said in an ephemeral commentCollinsworth
Posting it as answer.Lint
L
0

Git does not work this way.

It has nothing to do with number of commit or content.

Git uses heuristics to "shrink" the data size so you can have similar files with shared content and the content will not be duplicated. It's not relevant to measure git size on per commit basis.

Lint answered 12/11, 2015 at 20:29 Comment(1)
I understood your comment and updated the original post accordingly to include the measurement over time as an example see: blogs.wandisco.com/2013/08/23/git-repository-metricsTurnbuckle

© 2022 - 2024 — McMap. All rights reserved.