Question: How can I remove / prune / gc unreferenced blobs in a partially cloned git repository?
Details: I am evaluating whether Git Partial Clone can become a replacement for Git LFS, now where both GitLab and GitHub seem to have implemented full support for it (I couldn't find a beta label). As large binaries / blobs are only fetched on checkout with --filter=blob:none
, the git repository on disk and the fetch performance seem both reasonably fast.
That being said, I am struggling how to clean / prune the blobs similar to git LFS prune. When working with a reasonably sized repository over time, you still end up with all blobs that have accumulated over time that are not referenced by HEAD (anymore).
What I've tried: I was hoping that git gc --prune=today --aggressive
would be able to understand the active filter (or that I can pass a filter) to convert all blobs / trees / commits, that are not referenced by the current checkout, to promisor objects. Unfortunately, I could not find a way to reduce the size of the partial cloned repository after using it for quite a while
edit: I am using git version 2.36.0