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?
You can also use
git log -p -- path/to/submodule
to see all commits that have updated your submodule pointer if you want to see how it changed over time.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With