I have a project with a lot of binaries (mostly pdfs) that I'm using git-lfs with. The project is about 60mb but I found that my .git/lfs/objects director is about 500mb. I presume these are cached versions of previous commits. Is there a way to gracefully delete these (ie delete them without corrupting the state of git)? The odds of me ever wanting previous versions of the files in LFS are near 0 now especially since the project is over.
Using Git LFS makes it possible to version large files (and manage blobs) while freeing up space in Git repositories. And Git LFS is often a fix for pushing large files to GitHub.
Git LFS (Large File Storage) is a Git extension developed by Atlassian, GitHub, and a few other open source contributors, that reduces the impact of large files in your repository by downloading the relevant versions of them lazily.
Git LFS objects can be large in size. By default, they are stored on the server GitLab is installed on.
I found the git-lfs man pages. It turns out there is a git lfs prune
command which does exactly what I needed:
C:\Path\to\project [master]> du -h -d 0
625M .
C:\Path\to\project [master]> git lfs prune
* 101 local objects, 88 retained
Pruning 13 files, (393.8 MB)
* Deleted 13 files
C:\Path\to\project [master]> du -h -d 0
231M .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With