问题描述
我有一个包含很多二进制文件(主要是pdf)的项目,我正在使用git-lfs。该项目约为60mb,但我发现我的.git / lfs / objects主管约为500MB。我认为这些是先前提交的缓存版本。有没有办法优雅地删除这些(即删除它们而不会破坏git的状态)?我想要LFS中以前版本的文件的几率现在接近0,特别是在项目结束之后。
找到了。事实证明,有一个 git lfs prune
命令,它正是我所需要的: C:\Path\to\project [master]> du -h -d 0
625M。
C:\Path\to\project [master]> git lfs prune
* 101本地对象,88保留
修剪13个文件,(393.8 MB)
*删除13个文件
C:\Path\to\project [主] GT; du -h -d 0
231M。
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.
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 .
这篇关于git lfs“objects”占用大量磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!