Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

updating submodules with git-flow

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?

like image 781
elSnape Avatar asked Aug 21 '13 11:08

elSnape


People also ask

Will git pull update submodules?

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 .

How do you update a submodule in a project?

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.

Should you use git submodules?

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.


1 Answers

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.

like image 123
Sigi Avatar answered Oct 18 '22 06:10

Sigi