Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 473
user1816847 Avatar asked Jan 20 '16 05:01

user1816847


People also ask

Does git LFS save space?

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.

What is git LFS large file storage used for?

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.

Where are LFS objects stored?

Git LFS objects can be large in size. By default, they are stored on the server GitLab is installed on.


1 Answers

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    .
like image 113
user1816847 Avatar answered Oct 17 '22 10:10

user1816847