监视为什么git add.慢? [英] To monitor why git add . slow?
问题描述
假设项目长时间没有完成添加和提交.
我执行git add .
,但是花费太多时间.
我想估计在当前情况下哪些文件/目录最昂贵.
我有一个很好的.gitignore
文件,该文件可以正常工作,但有时,我仍然有太多和/或某些东西很难添加并提交给Git.
Assume project where no add and commit has been done for a long time.
I do git add .
but it takes too much time.
I would like to estimate which files/directories are most expensive in the current case.
I have a good .gitignore
file which works sufficiently but, still sometimes, I have too much and/or something too difficult to be added and committed to Git.
我的目录中经常有目录,大小从300GB到2 TB.
尽管在.gitignore
中的directory/*
和directory/
中将它们排除在外,但添加速度很慢.
I have often directories which size is from 300GB to 2 TB in my directories.
Although excluding them by directory/*
and directory/
in .gitignore
, the addition is slow.
您如何估算哪些目录/文件过于昂贵而无法提交?
How can you estimate which directories/files are too expensive to be committed?
推荐答案
Git缓慢通常来自大型二进制文件.这并不是因为它们是二进制文件,而是因为二进制文件往往很大且压缩和压缩比较复杂.差异
Git slowness is generally from large binary files. This isn't because they're binary, just because binary files tend to be large and more complex to compress & diff.
根据您的编辑指示文件大小,我怀疑这是您的问题.
Based on your edit indicating the file sizes, I suspect this is your problem.
此问题的答案提供了一些解决方案:从源代码管理中删除它们,手动运行git gc
等
The answers to this question offer a few solutions: removing them from source control, manually running git gc
, etc.
这篇关于监视为什么git add.慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!