gitgithubgit-lfs

git lfs "objects" taking a lot of disk space


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.


Solution

  • 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    .