git - `.git/objects/info`目录是什么

标签 git

.git/objects 目录中有 info 子目录。它是干什么用的?我知道 .git/objects 目录用于什么以及什么是 .git/objects/pack 目录。但是我找不到关于.git/objects/info 目录的信息。它可能在表面上的某个地方,但 info 是过于通用的名称,无法在 google 中搜索 - 太多不相关的结果。

最佳答案

Repository layout documentation :

objects/info
Additional information about the object store is recorded in this directory.

objects/info/packs
This file is to help dumb transports discover what packs are available in this object store. Whenever a pack is added or removed, git update-server-info should be run to keep this file up-to-date if the repository is published for dumb transports. git repack does this by default.

objects/info/alternates
This file records paths to alternate object stores that this object store borrows objects from, one pathname per line. Note that not only native Git tools use it locally, but the HTTP fetcher also tries to use it remotely; this will usually work if you have relative paths (relative to the object database, not to the repository!) in your alternates file, but it will not work if you use absolute paths unless the absolute path in filesystem and web URL is the same. See also objects/info/http-alternates.

objects/info/http-alternates
This file records URLs to alternate object stores that this object store borrows objects from, to be used when the repository is fetched over HTTP.

所以它纯粹是 git 内部的。

例如:

$ cat .git/objects/info/packs
P pack-fac58f9273f12d454896cdc6070b9607e271e530.pack

$ ls -1 .git/objects/pack/
pack-597bfea331852c930d2cd014e0328c458417ea05.pack
pack-d5589be9a1ca818d38efb0e9f185cc816f4749ad.pack
pack-fac58f9273f12d454896cdc6070b9607e271e530.idx
pack-fac58f9273f12d454896cdc6070b9607e271e530.pack

它用于 http.c#http_get_info_packshttps-push.c#fetch_indices 使用.

关于git - `.git/objects/info`目录是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45813786/

相关文章:

git - 是否可以在 Git 中为分支命名?

macos - git:EOF 处的新空行

git - OpenSSH 提供了错误的公钥?

git - 如何在 git show-branch 中获取提交哈希?

git - 对 Github Pages 使用 npm run deploy 时 gh-pages -d build 失败

git - 如何更改 Git 存储库的位置

python - GitPython pull 后工作副本中没有任何内容出现

git - 如何按最近 checkout 对 git branch 的输出进行排序

git - Bitbake,从 git 构建但不是最新提交

eclipse - Eclipse Git(EGit)远程:无效的数据包行 header