[英]Is there a way to confine Git to a sparse checkout?
As a recent question hinted, I'm looking for a way to speed up operations on a Git repository with a very large number of files (~6 million). 正如最近的一个问题所暗示的那样,我正在寻找一种方法来加速Git存储库上的操作,这些存储库包含大量文件(约600万)。 I'd rather not use submodules.
我宁愿不使用子模块。 The problem is that operations are pretty slow.
问题是操作很慢。 Is it possible to have one large repository but instruct Git to focus on only a portion of the repository?
是否可以拥有一个大型存储库,但是指示Git只关注存储库的一部分? I thought that maybe creating a sparse-checkout would do it but the read-tree operation seems to delete files not specified in the sparse-checkout file and takes a really long time.
我认为可能会创建一个稀疏结账,但是读取树操作似乎删除了稀疏检出文件中未指定的文件并且需要很长时间。 Is it possible to do a read-tree keeping all the files where they are and is proportional only to the number of files specified in the sparse-checkout file?
是否可以执行读取树,使所有文件保持原样,并且仅与稀疏检出文件中指定的文件数成比例?
Not currently, no. 目前不是,没有。 Git only recently (1.7+) added any sparse checkout support at all, and it's still fairly bare bones - mostly because Git wasn't really designed to handle only working with part of a repository.
Git最近才(1.7+)添加了任何稀疏的checkout支持,而且它仍然相当简单 - 主要是因为Git并不是真正设计为只处理部分存储库。
It was more designed to be a one-repository-per-project version control system. 它更适合作为每个项目的一个存储库版本控制系统。 Submodules were the method chosen to handle "projects" that had many large subcomponents.
子模块是选择处理具有许多大型子组件的“项目”的方法。
First, I would suggest learning and using Submodules. 首先,我建议学习和使用子模块。
You can script what you like with 您可以编写自己喜欢的内容
git ls-tree sha1
git show sha1:path/to/some/file.txt
and other low level commands. 和其他低级命令。 Also see bash commands such as
另请参阅bash命令,例如
xargs
grep
cut
and piping. 和管道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.