Interaly Git如何如此快速地构成文件(“学术上的“问题”)

发布于 2025-01-19 15:02:28 字数 336 浏览 2 评论 0原文

我只是向 Git 专家提出“学术”问题。

我找不到任何关于 Git 实际上如何在内部从所有提交中组合文件的信息。 我无法想象它会迭代所有提交,直到现在(从第一个提交开始并不断更改/添加/删除等,直到它具有当前版本)。

对于具有许多提交、许多大文件等的大型代码库来说,不是很慢吗?但也许我的想象是错误的。 也许它偶尔会做一次工作,并在一些提交后保存“完整图片”以保持“组合”快速,所以它不需要从头开始,我不知道:)...类似“记忆”。

这里有人更好地理解 Git 计算当前文件时内部发生的情况吗?

I have just "academic" question for Git experts.

I could not find anything about how Git actually internaly compose files from all the commits.
I could not imagine that it iterate through all commits untill now (go from the very first commit and keep changing/adding/deleting etc. until it have current version).

Wouldn't it be slow for large codebases with MANY commits, many big files etc.? But maybe I am imagine it wrong.
Maybe it do the work once in a while and save the "complete picture" after some commits to keep the "composing" fast, so it doesn't need to start from the very beginning, I dont know :) ... something like 'memoization'.

Has anybody here better understanding of what is going on internally in Git when it figuring out current files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文