Git在哪里存储子模块提交的SHA1? [英] Where does Git store the SHA1 of the commit for a submodule?

查看:106
本文介绍了Git在哪里存储子模块提交的SHA1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道当你将一个子模块添加到一个git仓库时,它会跟踪它的sha1引用的该子模块的特定提交。



我试图找到哪里这个sha1值被存储。


$ b $ <<> code> .gitmodules 和 .git / config files仅显示子模块的路径,但不显示提交的sha1。



git-submodule(1)仅供参考,它表示 gitlink 条目和 gitmodules(5)的参考资料并没有对此作任何说明。

解决方案

它直接存储在Git的对象数据库中。子模块所在目录的树对象将有一个子模块提交的条目(这就是所谓的gitlink)。



试着做 git ls-tree master<路径到目录包含子模块> (或者只是 git ls-tree master 子模块位于顶层目录中)。


I know that when you add a submodule to a git repository it tracks a particular commit of that submodule referenced by its sha1.

I'm trying to find where this sha1 value is stored.

The .gitmodules and .git/config files only show the paths for the submodule, but not the sha1 of the commit.

The git-submodule(1) reference only speaks of a gitlink entry and the gitmodules(5) reference doesn't say anything about this either.

解决方案

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").

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在哪里存储子模块提交的SHA1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆