The commit hash for the submodule is stored in the tree object. You can find it by running git ls-tree -r HEAD^{tree} | less
and searching for the directory where your submodule lives.
How does git know which commit to check a submodule out at?
-
09-07-2023 - |
Question
I have cloned a repo that includes a submodule. I know that running git submodule init
inserts a reference to the submodule into .git/config
, and that running git submodule update
pulls the files from the submodule (as it stood at commit 3ab4ef2) into my main repo...
Now I'm on Windows here and can't use grep so I'm having trouble figuring out how my main git repo knows that it is tied to commit 3ab4ef2.
Where would I find a reference to that commit in my main repo?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow