When making a release with git, using the git-flow model, I switch my repository to point to the latest commit in master, tag and then build from the tag. Is it good practice to merge changes into master for all the repository's submodules, and have them point to master (that is, the latest commit in master), or is it sufficient to leave all submodule commits unchanged?
Once you have set up the submodules you can update the repository with fetch/pull like you would normally do. To pull everything including the submodules, use the --recurse-submodules and the --remote parameter in the git pull command .
In order to update an existing Git submodule, you need to execute the “git submodule update” with the “–remote” and the “–merge” option. Using the “–remote” command, you will be able to update your existing Git submodules without having to run “git pull” commands in each submodule of your project.
Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.
Your commit on master
will record the commits of all the submodules that you use.
If somebody checks out the release that you just cut (and tagged), they will be responsible to run git submodule update
in order to check out the correct commit on each submodule.
Submodule checkouts are always headless commits, i.e. addressed by their SHA-1 hash value and not by a symbolic ref (branch name). Therefore, it does not matter what branch they point to.
All that matters is what commits are recorded on master
(of the superproject).
So, to answer your question: it's OK to leave the submodule commits unchanged when you make your release.
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