如何查看git子模块指向哪个提交 [英] How to see which commit a git submodule points at

查看:447
本文介绍了如何查看git子模块指向哪个提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,如果您在git中添加一个子模块,则它指向该子模块中的某个提交.

As far as I know, if you add a submodule in git then it points to a certain commit in that submodule.

是否有任何方法可以查看子模块所指向的提交而无需将其检出?

Is there any way to see which commit a submodule is pointing at without checking it out?

推荐答案

确定...

git ls-tree <commit>:<path to dir that has a submodule as a subdir>

示例:git ls-tree HEAD:src/thirdparty

或者只是:git ls-tree -r HEAD可以看到所有内容.

Or just: git ls-tree -r HEAD to see everything.

子模块将显示为commit类型(与通常的blobtree相对).

Submodules will show up as type commit (as opposed to the usual blob or tree).

这篇关于如何查看git子模块指向哪个提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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