I have git submodule.
I have .gitmodules
file.
[submodule "templates-ui/src/main/webapp/js/app/ui"]
path = templates-ui/src/main/webapp/js/app/ui
url = [email protected]:xxx/ui-core.git
I did init
and update
.
But how to specify the version of the submodule? For example I may have version of of ui-core
as 2.3.2
or 2.3.3
.
git tracks submodules as ordinary objects. this means, that once you added the submodule, the exact state (e.g. revision) of the submodule is stored in the parent module as well.
so do:
cd submodule
git checkout v2.3.2
cd -
git commit . -m "use submodule v2.3.2"
as side-effect of the way githandles submodules is, that you cannot have a "live" submodule¹ (where you always track the HEAD of a master branch) - a submodule is really always in a detached state.
¹ well you can; nobody keeps you from tracking master/HEAD in the submodule by manually pull
ing within the submodule; but the parent module will always reference a specific commitish.
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