Hello everyone,
I'm facing an issue with Git LFS and would appreciate some guidance. I have a Git LFS repository where I've been working on a branch that involved several commits, each modifying a binary file. This resulted in multiple versions of the file being stored in LFS. Before merging this branch into main
, I squash the commits to maintain a clean history and, more importantly, to reduce the LFS storage usage.
However, I've noticed that even after squashing, the unreferenced file versions are not automatically deleted, which still consumes LFS space.
Is there a way to automate the cleanup of these unreferenced files rather than having to do it manually? Perhaps through a post-merge hook or another method?
Thanks in advance for your help!
G'day, @Anton Liashkevich
Welcome to the community.
I believe there's a way to delete the LFS via a script you can check them out at:
You'll have to get the list of LFS OID and save it as oids.txt and the script will use them to delete the LFS files.
Regards,
Syahrul
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.