Search code examples
gitgit-submodules

Tagging git submodules with release


We have a project whereby we use a lot of submodules. When branching and tagging our release I would like to ensure that the submodules state is preserved with the branch and tag. So that if we need to build the release again we can ensure the submodule is the same version as what we originally used. What is the best way to do this?

Thanks


Solution

  • A submodule is recorded in the parent repo as a gitlink (a special entry in the index).

    It means the submodule state does not change when tagging or branching: the gitlink is still the same, and the submodule would checkout the same SHA1.

    Making a branch in the parent repo has no effect or relation with making a branch in a submodule. Same for tags.