git存储模型浪费吗?
我正在阅读有关 git 如何在 Git 对象模型1。
听起来如果我更改文件中的一行,它将重新存储整个文件。与仅存储差异的 Subversion 相比,这会浪费大量空间吗?
(或者我误解了存储模型?)
1 截至 2011 年提出问题时。当前最接近的链接是 Git 内部 - Git 对象。
I was reading about how git stores changes in The Git Object Model1.
It sounds like if I change one line in a file, it's going to re-store the entire file. Does this waste a lot of space compared to say, Subversion which only stores diffs?
(Or am I misunderstanding the storage model?)
1 As of 2011 when question was asked. Current closest link is Git Internals - Git Objects.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Git 最终会在其内部维护的常规过程中将所有内容打包到增量压缩档案中,此时这不再是问题。
不过,今天这并不是一个真正的问题。 Git 的理念是磁盘空间很便宜,并且最好针对速度而不是存储效率进行优化。与只需要一半磁盘空间的 SCM 相比,速度快一倍的 SCM 可能会为您提供更好的服务。
请参阅 Git 书籍 中有关 Packfile 以及 git repack 和 git-pack-objects。
Git will eventually pack everything into delta-compressed archives during the regular course of its internal maintenance, at which point this is no longer an issue.
This isn't really an issue today though. Git's philosophy is that disk space is cheap, and it's better optimize for speed rather than storage efficiency. Chances are you'll be better served by a SCM which is twice as fast, as opposed to one which requires half the disk space.
See the Git Book's chapter on The Packfile as well as git repack and git-pack-objects.
Git 确实使用 zlib 压缩存储的文件,并且还打包它们以更高效的存储。
Git does compress stored files with with zlib and it also packs them for a more efficient storage.
其实不是。有一篇很好的文章描述了 git 的优点: http: //web.archive.org/web/20110902055701/http://whygitisbetterthanx.com:80/
Actually not. There is a good article describing the advantage of git: http://web.archive.org/web/20110902055701/http://whygitisbetterthanx.com:80/