Reputation: 316
I'm currently using a gitlab server and local git repositories for several projects. My local git repository, which I used since the beginning of the project and were I was working in all the time, was using something about 100 MB. Then I cloned the remote repository in another directory and noticed that this directory is only about 30 MB. The history and the working directory were all the same, how's that possible? And maybe more important: How can I "clean up" my local repository instead cloning permanently?
Upvotes: 0
Views: 346
Reputation: 265817
Git's object model and database implementation use a space-inefficient mode of storing first to improve performance. When cloning, all objects are compressed to reduce network traffic.
To manually compress your local repository run git gc
, which will pack objects together and reduce space requirements. It will also remove old objects, which are not in use anymore (deleted branches, old stashes, etc.)
Upvotes: 1