I have some repositories that keep growing in size, so far this has not presented a problem for me, but I can not help but thing that at some point in the future it will sooner or later. So for now I thought I would take a moment tot just fool around with a test git folder, and do a little research on how to know how big a git repository is to begin with at least.
In late versions of git there is the git count-objects command that can be used to know how many objects there are and there disk consumption. So this might be the best way to know how much space a git folder is taking up assuming that I will always be using a late version of git that will support this.
I often find that it might be best to start over with a test repository rather than a clone of a repository that I might end up accidentally pushing changes to. So in this section I will be creating a whole new repository with git, and then use the git count-objects command to track the size of the repository.
First off I create a new repository with the git init command in a new folder.
I will then want to add something to it such as a dummy README file.
And a first commit.
So now I just need to call the git count-objects command in the git folder to get a count of all the objects, and a size value. If I call it without any arguments I get a size in kilobytes.
However there are some options that can result in a more detailed output of what is going on so far in this test repository. By passing the v option I get a more verbose output. On top of that there is also the uppercase H option that will give the output in a more Human readable form.