Git 的包文件存储在哪里?
我最近很高兴了解了 Git 如何存储其对象:也就是说,如果您正在寻找哈希值为 0f9f33986446bd8e832dac72177295bb75d3ec90
的提交(或树或博客),您将在以下位置找到它:项目的 .git
目录,位于 objects/0f/9f33986446bd8e832dac72177295bb75d3ec90
下。换句话说,哈希值的前两个字母是子目录,其余是文件名。
很高兴看到存储是如何完成的,但后来我在 Git 社区书籍< 中阅读了有关包文件的信息/a>.
我是否正确理解了链接 - 它们不是存储在同一目录结构下吗?如果没有,它们到底存储在哪里?
I was recently excited to learn a bit about how Git stores its objects: namely, if you're looking for a commit (or tree, or blog) with a hash of 0f9f33986446bd8e832dac72177295bb75d3ec90
, you will find it in the .git
directory of your project, under objects/0f/9f33986446bd8e832dac72177295bb75d3ec90
. In other words, the first two letters of the hash are the subdirectory and the rest is the file name.
It's neat to see how the storage is done, but then I read about pack files in the Git Community Book.
Am I understanding the link correctly - are they not stored under this same directory structure? If not, where exactly are they stored?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
./objects/pack
下(您可能必须启动git gc
)。打包的东西遵循一个相当简洁的启发式,在实践中往往会很好地打包东西。您可以快速搜索包:Under
./objects/pack
(you may have to fire off agit gc
). The packing stuff follows a rather neat heuristic which tend to pack things well in practice. You can quickly search for packs: