Search code examples
gitgit-submodulesgit-tag

git submodule version based on tag


How do git submodules and tags work, specifically can I use git tags in the host module to change which has the submodule points to?

Lets say that I have a module called main and under that, I added a submodule called dep. I have just released a new version, so I tag the whole repo with REL_1. Life goes on, I code some more and update the dep submodule and commit that to HEAD.

What happens when I checkout REL_1? Will dep go back to the hash it had when I created the tag?

Thank you!


Solution

  • Will dep go back to the hash it had when I created the tag?

    It will go back to the hash present when you tagged the whole repo with REL_1

    A git submodule update --remote would then update the submodule (to latest master by default)