停止 git gc --aggressive,这是一件坏事吗?
我正在一个非常大的存储库(apx 100 GB)上运行 git gc --aggressive 。它从两天前的晚上开始运行,几个小时后,它一直卡在:“压缩对象:99%(76496/76777)”
如果我 Ctrl-C 这个过程,有什么后果?我的仓库会无法使用吗?我的直觉告诉我不会,但我想听听一些意见。谢谢!
I am running a git gc --aggressive
on a very large repo (apx 100 gb). It's been running since two nights ago, and as of a couple hours, it has been stuck on: "Compressing Objects: 99% (76496/76777)"
If I Ctrl-C the process, what are the consequences? Will my repo be unusable? My intuition says no, but I'd like some opinions. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
git 应该永远不会受到这样的干扰。不过,如果您担心,我建议 Ctrl+Z 然后运行
git fsck --full
以确保系统一致。有许多 git-config 变量可以帮助您的 git-gc 运行得更快。我在一个特定的大型存储库上使用以下内容,但还有更多选项可以随机尝试(或仔细研究,以两者为准)。
仅当您的问题是内存不足时,这些才有帮助。
请注意,Brian J Murray 报告了最佳 (git-gc) 性能,
pack.threads
应设置为您拥有的核心数量。另请注意 VonC 的另一个答案,它说您可以通过将 gc.aggressiveDepth 设置为小于默认值 250 的值来权衡 gc 性能和磁盘使用情况。git is supposed to be always safe from interruptions like this. If you are worried, though, I suggest Ctrl+Z and then run a
git fsck --full
to make sure the system is consistent.There are a number of git-config variables which might help your git-gc go faster. I use the following on one particular large repo, but there are many more options to randomly try (or carefully study, whichever).
These only help if your problem is that you are running out of memory.
Note that Brian J Murray reports for best (git-gc) performance,
pack.threads
should be set to the number of cores you have. Also note the other answer by VonC which says you can trade gc performance against disk usage by settinggc.aggressiveDepth
to a smaller value than the default of 250.FWIW,我刚刚通过使用 CTRL+C 中止 git gc 来损坏存储库。
git fsck
现在显示以下错误:并且有很多错误
我不会对此进行调查,但我想指出我将避免中止
git gc< /代码>。
FWIW, I just corrupted a repository by aborting
git gc
with CTRL+C.git fsck
now shows the following errors:And quite a few
I'm not going to investigate on this, but I would like to point out that I'm going to avoid aborting
git gc
.注意:有一个有趣的演变git 2.0(2014 年第 2 季度):
这在 提交 125f814,由 Nguyễn Thái Ngọc Duy (
pclouds
):这可以帮助避免在大型存储库上运行该命令时遇到的“冻结”问题。
Note: there is an interesting evolution for git 2.0 (Q2 2014):
This is described in commit 125f814, done by Nguyễn Thái Ngọc Duy (
pclouds
):That could help avoiding the "freeze" issue you have when running that command on large repos.