Search This Blog

Friday, February 8, 2013

Git - running garbage collection on your repository

There is a neat feature of git called "garbage collection" that I recently got familiar with. My half-a-year repository which had 1.6 GB (the .git folder itself having had 424 MB) was shrunk to 1.5 GB (with the .git folder having 292 MB).

C:\Repo\.git>git gc
Counting objects: 55965, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (15987/15987), done.
Writing objects: 100% (55965/55965), done.
Total 55965 (delta 42100), reused 52422 (delta 38932)

There is also an "aggressive" garbage collection option which you can use:


Usually git-gc runs very quickly while providing good disk space utilization and performance. This option will cause git-gc to more aggressively optimize the repository at the expense of taking much more time. The effects of this optimization are persistent, so this option only needs to be used occasionally; every few hundred changesets or so.

For more info have a look here.

No comments:

Post a Comment

If you like this post, please leave a comment :)