This option is intended primarily for sampling, all sub-modules perform, not just pull one particular branch, such as the master, for the reasons given in the following two commits:
(note that the bug is fixed in Git 2.11, see the end of this answer)
For git pull this option was introduced in ( commit 7dce19d, November 2010, Git 1.7.4-rc0) :
fetch / pull : add option --recurse-submodules
So far you have had to call " git submodule update " (without the -N|--no-fetch option) or something like " git submodule foreach git fetch " to retrieve new commits in populated submodules from their remote.
This can lead to " (commits not present) " messages on the output of " git diff --submodule " (which is used by " git gui " and " gitk ") after retrieving or pulling new commits in a superproject and is an obstacle to implementing recursive verification of submodules.
In addition, the β git submodule update β cannot retrieve changes when disconnected, so it was very easy to forget to get the changes in the submodules before disabling them, only to find out later that they are needed.
This patch adds the --recurse-submodules to recursively extract each populated submodule from the url configured in the .git/config submodule at the end of each git fetch or during a git pull to the superproject. Submodule paths are taken from the index.
Commit 88a2197 (March 2011, Git 1.7.5-rc1) explains a bit more:
fetch / pull : overwrite if necessary in submodules
In order to have access to all records of filled submodules referenced by a superproject, it is enough only if the β git fetch β recursively submodule is required when new entries are written to the records of the superproject.
- The presence of these commits are extremely useful when using "option
--submodule " for " git diff " (that is " git gui " and " gitk " to do with the 1.6.6), since all the sub-modules are made necessary to create access to the descriptive conclusion. - Also, the compilation of the merge submodule (added in 1.7.3) depends on the submodule present, which is present in the work .
- And last but not least: it allows you to disable the work when using submodules , since all the commits necessary for the successful "
git submodule update -N " will be automatically loaded.
Thus, we select this mode as the default for extraction and extrusion.
git pull origin master --recurse-submodules git submodule foreach git pull origin master
The first should pull out, and not just pull out and be equivalent to the second. Perhaps this is a problem with the parameter:
git pull --recurse-submodules origin master
However, this is not the recommended way to update a submodule for this branch: see the next section.
Please note that the correct way to actually pull out of the wizard will register the main branch in the submodule , which makes the Submodule Tracking Wizard
git config -f .gitmodules submodule.<path>.branch <branch>
Then a simple git submodule update --remote --recursive .
And the branch to extract / pull is written in the parent repo (in the .gitmodules file), so you donβt even need to remember which branch you need in order for your submodule to be updated.
Git Update 2.11 (Q4 2011)
The presence of a submodule whose repository " .git " is somehow corrupted has caused several commands to return to the cycle of submodules forever.
See commit 10f5c52 (September 01, 2016) Junio ββC Hamano ( gitster ) .
(merger of Junio ββC Hamano - gitster - on commit 293c232 , 12 Sep 2016)