什么是Git命令来确定哪个提交更改了子模块指针? [英] What's the Git command to determine which commit changed a submodule pointer?
问题描述
我正在解析对git repo进行的一系列更改,其中一些涉及子模块。我使用 git blame
在子模块中查找相关的提交,但有没有一种简单的方法可以找到我的主repo中的哪个提交将子模块指针更改为该提交? p>
1 < - 2 < - 3 < - 4 <-5(提交的主链)
| | | | |
1 1 1 2 2(Submodule)
我已经找到子模块#1改成子模块#2(比如说它是9d95812e ...)。如何确定main-commit#4是否是第一次使用新子模块提交的事实?
可以告诉这是不太可能的,最接近你可以得到的是确定哪些提交添加或删除了特定的子模块指针:
git log -p -SSubproject commit c4965b1 ...
得出:
提交xyz123456
作者:
日期:
消息
diff ...
@@ -1 +1 @@
- 子项目提交901231290321
+子项目提交1902u8129039
唯一的是 +/-
不是您要搜索的实际字符串的一部分,所以您不能寻找一个特别的添加或删除,但使用 -p
标志可以让你轻松看到。
I'm dissecting a series of changes made to a git repo, some of which involved a submodule. I used git blame
to find the relevant commit within the submodule, but is there a simple way to locate which commit in my main repo changed the submodule pointer to that commit?
Cue simple diagram:
1 <- 2 <- 3 <- 4 <- 5 (Main chain of commits)
| | | | |
1 1 1 2 2 (Submodule)
I have located the commit where submodule #1 changed into submodule #2 (say it's 9d95812e...). How do I determine the fact that main-commit #4 is where the new submodule commit was first employed?
From what I can tell this isn't quite possible, the closest you can get is to determine which commits added or removed that particular submodule pointer:
git log -p -S "Subproject commit c4965b1..."
yields:
commit xyz123456
Author:
Date:
Message
diff...
@@ -1 +1 @@
-Subproject commit 901231290321
+Subproject commit 1902u8129039
The only thing is +/-
are not part of the actual string you're searching for, so you can't look for an addition or removal specifically, but using the -p
flag will let you see this easily.
这篇关于什么是Git命令来确定哪个提交更改了子模块指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!