Git pack 文件名——摘要是什么?

标签 git pack

Git 将单个对象存储在 .git/objects/ab/cdefgh... 中,其中 ab 是 SHA1 摘要的第一个字节。

但是,包文件不遵循相同的命名策略,而且我找不到关于它是如何命名的文档。有什么见解吗?

最佳答案

包文件保存在 objects/pack 中,记录在 gitrepository layout 中.在此目录中,它们以索引文件和包文件本身的形式存储,例如:

pack-a862cfa8b080773290073999c800a2e655ef9b5d.idx
pack-a862cfa8b080773290073999c800a2e655ef9b5d.pack

这些文件名中的 SHA1sum 是如何计算的,在 git-pack-objects 中有解释。文档(我的重点):

Write into a pair of files (.pack and .idx), using <base-name> to determine the name of the created file. When this option is used, the two files are written in <base-name>-<SHA1>.<pack,idx> files. <SHA1> is a hash of the sorted object names to make the resulting filename based on the pack content, and written to the standard output of the command.

object names是包文件中对象的 SHA1 和。

关于Git pack 文件名——摘要是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5469978/

相关文章:

git - 如何在 repo 中列出所有文件及其提交的 SHA

ios - 无法将新创建的 cocoa pod 添加到私有(private) pod 规范

git - 事件分支数量的最佳范围是多少?

Perl:将int打包成任意长度的字节串

java swing无法扩展JFrame的高度?

perl - 在 Perl 中打包/解包二进制字符串

git子模块提交/推/pull

java - Spring Cloud git 配置——将存储库放在直接包含类路径的文件夹中?

ruby 包和十六进制值

java - 打印预览(打包不起作用)