gitfilesize

Find size of Git repository


What's a simple way to find the size of my Git repository?

And I don't mean du -h on the root directory of my repository. I have a lot of ignored files, so that size would be different from my total repository size. I essentially want to know how much data would be transferred upon cloning my repository.


Solution

  • UPDATE git 1.8.3 introduced a more efficient way to get a rough size: git count-objects -vH (see answer by @VonC)

    For different ideas of "complete size" you could use:

    git bundle create tmp.bundle --all
    du -sh tmp.bundle
    

    Close (but not exact:)

    git gc
    du -sh .git/
    

    With the latter, you would also be counting: