如何缩小.git文件夹 [英] how to shrink the .git folder
问题描述
但我的.git文件夹有5GB(!)的惊人大小。因为我把我的工作推到了外部服务器上,所以我不需要任何大的本地历史......
如何缩小.git文件夹以释放一些空间我的笔记本?我可以删除所有更改,比30天更旧吗?
非常感谢您的帮助:)
你可以调用
git gc --aggressive --prune
,它会在你的版本库中执行垃圾回收并修剪旧对象。你有很多二进制文件(档案,图像,可执行文件)经常改变吗?那些通常会导致巨大的.git文件夹(请记住,每个修订版和二进制文件的git存储快照压缩很糟糕) My current base has a total size of approx. 200MB.
but my .git folder has an amazing size of 5GB (!). since i push my work to an external server, i don't need any big local history...
how can i shrink the .git folder to free some space on my notebook? Can i delete all changes, that are older, than 30 days?
thanks a lot for any help :)
you should not delete all changes older than 30 days (i think it's somehow possible exploiting git, but really not recommended).
you can call git gc --aggressive --prune
, which will perform garbage collection in your repository and prune old objects. do you have a lot of binary files (archives, images, executables) which change often? those usually lead to huge .git folders (remember, git stores snapshots for each revision and binary files compress badly)
这篇关于如何缩小.git文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!