Git 在哪里存储子模块提交的 SHA1?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5033441/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where does Git store the SHA1 of the commit for a submodule?
提问by Abizern
I know that when you add a submodule to a git repository it tracks a particular commit of that submodule referenced by its sha1.
我知道当您将子模块添加到 git 存储库时,它会跟踪其 sha1 引用的该子模块的特定提交。
I'm trying to find where this sha1 value is stored.
我试图找到这个 sha1 值的存储位置。
The .gitmodules
and .git/config
files only show the paths for the submodule, but not the sha1 of the commit.
在.gitmodules
和.git/config
文件只显示了子模块的路径,但不是的提交SHA1。
The git-submodule(1)reference only speaks of a gitlink
entry and the gitmodules(5)reference doesn't say anything about this either.
该混帐子模块(1)参考只讲一个的gitlink
条目和gitmodules(5)参考不说这事,无论是。
回答by Dan Moulding
It is stored in Git's object database directly. The tree object for the directory where the submodule lives will have an entry for the submodule's commit (this is the so-called "gitlink").
它直接存储在 Git 的对象数据库中。子模块所在目录的树对象将具有子模块提交的条目(这就是所谓的“gitlink”)。
Try doing git ls-tree master <path-to-directory-containing-submodule>
(or just git ls-tree master
if the submodule lives in the top-level directory).
尝试这样做git ls-tree master <path-to-directory-containing-submodule>
(或者只是git ls-tree master
如果子模块位于顶级目录中)。