So, updating all my submodules is done by running
git submodule foreach \'git pull origin master\'
How do I update a specific submo
How do I update a specific submodule, located in say
bundle/syntastic, without updating any other submodules?
With Git 2.13 (and the help of submodule.
git clone --recurse-submodules="bundle/syntastic"
git config submodule.syntastic.update "git pull origin master"
The second line (to be executed only once) is needed because the clone --recurse-submodules[=
And that would only checkout the submodule at its gitlink recorded SHA1, not at the latest remote origin/master SHA1.
By adding the submodule.
As part of the Git 2.13 (Q2 2017) "active submodule" feature (see "Ignore new commits for git submodule"), you have this commit bb62e0a from Brandon Williams (bmwill):
clone: teach--recurse-submodulesto optionally take a pathspecTeach clone
--recurse-submodulesto optionally take a pathspec argument which describes which submodules should be recursively initialized and cloned.
If no pathspec is provided,--recurse-submoduleswill recursively initialize and clone all submodules by using a default pathspec of ".".
In order to construct more complex pathspecs,--recurse-submodulescan be given multiple times.This also configures the '
submodule.active' configuration option to be the given pathspec, such that any future invocation ofgit submodule updatewill keep up with the pathspec.Additionally the switch '
--recurse' is removed from the Documentation as well as marked hidden in the options array, to streamline the options for submodules. A simple '--recurse' doesn't convey what is being recursed, e.g. it could mean directories or trees (c.f.ls-tree).
In a lot of other commands we already have '--recurse-submodules' to mean recursing into submodules, so advertise this spelling here as the genuine option.
So the git clone --recursive man page now reads:
--recurse-submodules[=
After the clone is created, initialize and clone submodules within based on the provided pathspec.
If no pathspec is provided, all submodules are initialized and cloned.
Submodules are initialized and cloned using their default settings.
The resulting clone hassubmodule.activeset to the provided pathspec, or "." (meaning all submodules) if no pathspec is provided.
This is equivalent to runninggit submodule update --init --recursiveimmediately after the clone is finished. This option is ignored if the cloned repository does not have a worktree/checkout (i.e. if any of--no-checkout/-n,--bare, or--mirroris given)
Example from the t/t7400-submodule-basic.sh test:
git clone --recurse-submodules="." \
--recurse-submodules=":(exclude)sub0" \
--recurse-submodules=":(exclude)sub2" \
multisuper multisuper_clone
That would clone and update every submodules, except sub0 and sub2.
Bonus, with Git 2.22 (Q2 2019) "git clone --recurs" works better.
See commit 5c38742 (29 Apr 2019) by Nguyễn Thái Ngọc Duy (pclouds).
(Merged by Junio C Hamano -- gitster -- in commit 2cfab60, 19 May 2019)
parse-options: don't emit "ambiguous option" for aliasesChange the option parsing machinery so that e.g. "
clone --recurs ..." doesn't error out because "clone" understands both "--recursive" and "--recurse-submodules" to mean the same thing.Initially "clone" just understood --recursive until the
--recurses-submodulesalias was added in ccdd3da ("clone: Add the--recurse-submodulesoption as alias for--recursive", 2010-11-04, Git v1.7.4-rc0).
Since bb62e0a ("clone: teach--recurse-submodulesto optionally take a pathspec", 2017-03-17, Git v2.13.0-rc0) the longer form has been promoted to the default.But due to the way the options parsing machinery works this resulted in the rather absurd situation of:
$ git clone --recurs [...] error: ambiguous option: recurs (could be --recursive or --recurse-submodules)Add
OPT_ALIAS()to express this link between two or more options and use it in git-clone.