git clone --filter=blob:none
allows me to quickly clone a repo, without having to download gigabytes of objects. The repo size is small, as expected, because git cloned just the latest blobs at that point in time. Say, I work with this repo, switch branches, compare, etc. Git will download objects as and when needed. Now, the size of my repo is again increasing, locally, because of all of the downloaded objects. Is there a way to delete all of the local blobs and retain just the latest blob? In other words, is there a way to reach the same kind of state when I first cloned the repo using the partial clone with all commits, trees, but only the latest blob?
P.S. I know I can clone a fresh partial repo again. But I want to know if something is possible without having to clone again.
CodePudding user response:
Since this is not directly supported, try at least a git gc
, or the more recent (Git 2.30 ) git maintenance
git maintenance run --task gc
git maintenance run --task loose-objects --task incremental-repack
That won't be your initial state, but should be smaller.