Git索引和提交非常慢 [英] Git index and commit is very slow

查看:243
本文介绍了Git索引和提交非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地git存储库,并使用git add file1 file2 file3...将我的修改添加到git索引中.之后,我使用普通的git commit.每个命令大约需要3到6秒钟.我的存储库中约有150.000次提交.

I have a local git repository and use git add file1 file2 file3... to add my modifications to the git index. Afterwards I use a plain git commit. Each command takes around 3 to 6 seconds. My repository has around 150.000 commits.

我已经执行了git gc,因为我认为它会执行一些垃圾回收. SSD非常快.我想知道我可以打开哪些螺丝来加速这两个命令的执行.有什么建议吗?

I already executed git gc since I assumed it would perform some garbage collection. The SSD is quite fast. I am wondering which screws I can turn in git to accelerate the execution of these two commands. Any advice?

git version 2.21.0 (Apple Git-122.2)

我的系统是具有MacOS 10.14.6的Mac Pro.我将SSD与APFS一起使用.没有安装防病毒软件(或任何其他干扰扫描软件).

My system is a Mac Pro with MacOS 10.14.6. I use a SSD with APFS. No anti virus software (or any other interfering scanning software) is installed.

推荐答案

首先,更新到最新的Git 2.25:每个新版本都解决了性能问题.

First, update to the latest Git 2.25: performance issues are resolved with each new version.

第二,您可以使用 GIT_TRACE2_PERF 打印更多详细信息

Second, you can use GIT_TRACE2_PERF to print more details

GIT_TRACE2_PERF=1 git commit -m "test"

这篇关于Git索引和提交非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆