Where does the "super"-repo keep track of what commit each submodule is at?
I dont see any of that info in .gitmodules
What I want to achieve is if I tag the "super"-repo, with say 1.0-alpha
, then it will remember at what commit all the submodules was at that time, so when I checkout that tag later, I'll get the submodules at their correct commit position aswell.
Is this possible without manually writing down the commit-position for each submodule?
I now realize I can get that info later on by using:
git ls-tree <tag>
But then I'll have to go into each submodule and manually checkout that specific submodule at commit abc1234
..
/David
The current commit hash for a submodule is stored in the tree object(s) associated with the commit in the master project. If you do a git ls-tree -r HEAD
in your master project, each submodule is represented by a line of the form:
160000 commit <hash> <path/to/submodule>
This line indicates the commit in the submodule that should be checked out to match the commit in the master repository.