Consider a superproject with a submodule. If the superproject is checked out to a previous commit, how to automatically check out the submodule to the corresponding commit ?
Superproject : A - B
Submodule : X - Y - Z
Superproject HEAD is on B, corresponding index on submodule is on Z. Imagine that in A, submodule index was in X. How can I automatically checkout submodule on X when I check out superproject in A ?
I can do it manually thanks to this question but it is not efficient for superproject with many submodules.
[Edit] By checkout, I mean using git checkout commitSHA1
.
According to the doc,
Prepare to work on top of , by detaching HEAD at it (see "DETACHED HEAD" section), and updating the index and the files in the working tree.
I want to recompile code as it was in superproject commit A (possibly tagged) without knowing explicitly corresponding submodules indexes.