如何防止GIT中的垃圾收集? [英] How to Prevent Garbage Collection in GIT?
问题描述
Git神秘地不时"运行垃圾回收并删除您拥有的孤立提交.
Git mysteriously runs Garbage collection "from time to time" and deletes and orphaned commits you have.
https://www.kernel.org/pub/software/scm/git/docs/git-gc.html
从科学上讲,这大约发生在6-8小时后,您才意识到您真的需要刚刚删除的提交.
Scientifically, this will occur approximately 6-8 hours before you realize you really needed that commit which was just deleted.
我不想让我的文件被Git删除.如何完全禁用自动垃圾收集?
I'd rather not have my files deleted by Git. How can I disable automatic garbage collection altogether?
推荐答案
来自您刚刚链接到的页面相同:
某些git命令可能会自动运行git gc;有关详细信息,请参见下面的--auto标志.如果您知道自己在做什么,并且只想永久禁用此行为而无需进一步考虑,请执行以下操作:
Some git commands may automatically run git gc; see the --auto flag below for details. If you know what you’re doing and all you want is to disable this behavior permanently without further considerations, just do:
$ git config --global gc.auto 0
这篇关于如何防止GIT中的垃圾收集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!