1

We have a relatively large git repository (that is, the .git folder); we have been trying, unsuccessfully, to reduce its size, by obliterating files not needed any more in history, but the size didn't change significantly.

We have GCed the repository before the obliteration attempts.

Is there a way to gather statistics about a git repository, so that it's possible to understand what one can obliterate in order to save space, or, more generally, what approach to take respect to such objective?

======

After several tests, I've found that I wasn't successfully saving space on the local repository because the general procedures unlink the blobs, but don't necessarily remove them - I've found the solution to this specific problem here: git: can't find blob - want to get rid of it from pack

Community
  • 1
  • 1
Marcus
  • 5,104
  • 2
  • 28
  • 24
  • You mean your git history is too big, not your workspace? If you remove a file from your workspace the whole history remains so you won't lose too much space. You need to remove it from the history as well – iberbeu Mar 22 '13 at 15:15
  • Did you make a fresh clone of the repo to measure its size? That way, you're sure that no cruft is left lying around. – Fred Foo Mar 22 '13 at 15:15
  • Thanks for the notes - I will make the question to be more specific. – Marcus Mar 22 '13 at 15:32
  • possible duplicate of [Why is my git repository so big?](http://stackoverflow.com/questions/1029969/why-is-my-git-repository-so-big) – CB Bailey Mar 22 '13 at 16:28

2 Answers2

3

git count-objects -v will give you a both a count and cumulative size of the objects and pack files in your repository.

twalberg
  • 59,951
  • 11
  • 89
  • 84
  • I got count: 1273 and size: 8224. What do these numbers mean? 1273 is the number of files? 8224 of size is in Kb? – Aleksandrus Dec 21 '15 at 13:40
1

Pro Git suggests (in Maintenance and Data Recovery) using git verify-pack to find the largest objects. You can see an example of how to turn that into a list of the largest files in the history in the 'Prune large, unused content' section of this blog post (or here).

Joe
  • 29,416
  • 12
  • 68
  • 88