如何在我的存储库中找到对子模块的所有引用

How can I find all references to a submodule in my repository

是否有任何直接的 git 命令可用于获取父存储库中子模块的所有引用。希望在我的父存储库中找到指向指定子模块的所有 git 链接。 像 git ls-tree 这样的东西,它包含所有引用。

Let's say the submodule X is referenced in commits a, b, c in the parent repo. I need to get a list of all these commits.

对于添加或删除 X 的提交,您可以使用 diff filter:

git log --diff-filter=AD -- X

(注:X,不是X/

然后你可以列出 X 被引入和被删除之间的所有提交

git rev-list A ^B