@@ -95,7 +95,7 @@ too (and can also report changes to a submodule's work tree).
9595init [--] [<path>...]::
9696 Initialize the submodules recorded in the index (which were
9797 added and committed elsewhere) by setting `submodule.$name.url`
98- in .git/config. It uses the same setting from `.gitmodules` as
98+ in ` .git/config`, using the same setting from `.gitmodules` as
9999 a template. If the URL is relative, it will be resolved using
100100 the default remote. If there is no default remote, the current
101101 repository will be assumed to be upstream.
@@ -105,9 +105,12 @@ If no path is specified and submodule.active has been configured, submodules
105105configured to be active will be initialized, otherwise all submodules are
106106initialized.
107107+
108- When present, it will also copy the value of `submodule.$name.update`.
109- This command does not alter existing information in .git/config.
110- You can then customize the submodule clone URLs in .git/config
108+ It will also copy the value of `submodule.$name.update`, if present in
109+ the `.gitmodules` file, to `.git/config`, but (1) this command does not
110+ alter existing information in `.git/config`, and (2) `submodule.$name.update`
111+ that is set to a custom command is *not* copied for security reasons.
112+ +
113+ You can then customize the submodule clone URLs in `.git/config`
111114for your local setup and proceed to `git submodule update`;
112115you can also just use `git submodule update --init` without
113116the explicit 'init' step if you do not intend to customize
@@ -143,6 +146,8 @@ the submodules. The "updating" can be done in several ways depending
143146on command line options and the value of `submodule.<name>.update`
144147configuration variable. The command line option takes precedence over
145148the configuration variable. If neither is given, a 'checkout' is performed.
149+ (note: what is in `.gitmodules` file is irrelevant at this point;
150+ see `git submodule init` above for how `.gitmodules` is used).
146151The 'update' procedures supported both from the command line as well as
147152through the `submodule.<name>.update` configuration are:
148153
@@ -160,16 +165,18 @@ checked out in the submodule.
160165 merge;; the commit recorded in the superproject will be merged
161166 into the current branch in the submodule.
162167
163- The following 'update' procedures are only available via the
164- `submodule.<name>.update` configuration variable:
168+ The following update procedures have additional limitations:
165169
166- custom command;; arbitrary shell command that takes a single
167- argument (the sha1 of the commit recorded in the
168- superproject) is executed. When `submodule.<name>.update`
169- is set to '!command', the remainder after the exclamation mark
170- is the custom command.
170+ custom command;; mechanism for running arbitrary commands with the
171+ commit ID as an argument. Specifically, if the
172+ `submodule.<name>.update` configuration variable is set to
173+ `!custom command`, the object name of the commit recorded in the
174+ superproject for the submodule is appended to the `custom command`
175+ string and executed. Note that this mechanism is not supported in
176+ the `.gitmodules` file or on the command line.
171177
172- none;; the submodule is not updated.
178+ none;; the submodule is not updated. This update procedure is not
179+ allowed on the command line.
173180
174181If the submodule is not yet initialized, and you just want to use the
175182setting as stored in `.gitmodules`, you can automatically initialize the
0 commit comments