Git submodule specify version

I have a git submodule. I have a file .gitmodules.

[submodule "templates-ui/src/main/webapp/js/app/ui"]
    path = templates-ui/src/main/webapp/js/app/ui
    url = git@github.com:xxx/ui-core.git

I did initand update.

But how to specify the submodule version? For example, I may have a version ui-corelike 2.3.2or 2.3.3.

+4
source share
1 answer

git tracks submodules like regular objects. this means that after you add a submodule, the exact state (for example, revision) of the submodule is also stored in the parent module.

So:

cd submodule
git checkout v2.3.2
cd -
git commit . -m "use submodule v2.3.2"

as a side effect of the githandles submodules, is that you cannot have a “live” submodule (where you always keep track of the HEAD of the master branch) - the submodule is really always off.

¹ ; master/HEAD pull ing ; .

+6

All Articles