Skip to content

Commit 402e8a6

Browse files
jlehmanngitster
authored andcommitted
Documentation/submodule: add command references and update options
Reference the "git diff" and "git status" commands where they learned functionality that in earlier git versions was only available through the 'summary' and 'status' subcommands of "git submodule". The short option '-n' for '--summary-limit' was missing from the synopsis and the --init option was missing from the "options" section, add those there. And while at it, quote all options in backticks so they are decorated properly in the output formats which support that. Signed-off-by: Jens Lehmann <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d5b6629 commit 402e8a6

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

Documentation/git-submodule.txt

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ SYNOPSIS
1515
'git submodule' [--quiet] init [--] [<path>...]
1616
'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--rebase]
1717
[--reference <repository>] [--merge] [--recursive] [--] [<path>...]
18-
'git submodule' [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
18+
'git submodule' [--quiet] summary [--cached|--files] [(-n|--summary-limit) <n>]
19+
[commit] [--] [<path>...]
1920
'git submodule' [--quiet] foreach [--recursive] <command>
2021
'git submodule' [--quiet] sync [--] [<path>...]
2122

@@ -106,8 +107,13 @@ status::
106107
repository and `U` if the submodule has merge conflicts.
107108
This command is the default command for 'git submodule'.
108109
+
109-
If '--recursive' is specified, this command will recurse into nested
110+
If `--recursive` is specified, this command will recurse into nested
110111
submodules, and show their status as well.
112+
+
113+
If you are only interested in changes of the currently initialized
114+
submodules with respect to the commit recorded in the index or the HEAD,
115+
linkgit:git-status[1] and linkgit:git-diff[1] will provide that information
116+
too (and can also report changes to a submodule's work tree).
111117

112118
init::
113119
Initialize the submodules, i.e. register each submodule name
@@ -123,26 +129,29 @@ init::
123129
update::
124130
Update the registered submodules, i.e. clone missing submodules and
125131
checkout the commit specified in the index of the containing repository.
126-
This will make the submodules HEAD be detached unless '--rebase' or
127-
'--merge' is specified or the key `submodule.$name.update` is set to
132+
This will make the submodules HEAD be detached unless `--rebase` or
133+
`--merge` is specified or the key `submodule.$name.update` is set to
128134
`rebase` or `merge`.
129135
+
130136
If the submodule is not yet initialized, and you just want to use the
131137
setting as stored in .gitmodules, you can automatically initialize the
132-
submodule with the --init option.
138+
submodule with the `--init` option.
133139
+
134-
If '--recursive' is specified, this command will recurse into the
140+
If `--recursive` is specified, this command will recurse into the
135141
registered submodules, and update any nested submodules within.
136142

137143
summary::
138144
Show commit summary between the given commit (defaults to HEAD) and
139145
working tree/index. For a submodule in question, a series of commits
140146
in the submodule between the given super project commit and the
141-
index or working tree (switched by --cached) are shown. If the option
142-
--files is given, show the series of commits in the submodule between
147+
index or working tree (switched by `--cached`) are shown. If the option
148+
`--files` is given, show the series of commits in the submodule between
143149
the index of the super project and the working tree of the submodule
144-
(this option doesn't allow to use the --cached option or to provide an
150+
(this option doesn't allow to use the `--cached` option or to provide an
145151
explicit commit).
152+
+
153+
Using the `--submodule=log` option with linkgit:git-diff[1] will provide that
154+
information too.
146155

147156
foreach::
148157
Evaluates an arbitrary shell command in each checked out submodule.
@@ -153,9 +162,9 @@ foreach::
153162
superproject, $sha1 is the commit as recorded in the superproject,
154163
and $toplevel is the absolute path to the top-level of the superproject.
155164
Any submodules defined in the superproject but not checked out are
156-
ignored by this command. Unless given --quiet, foreach prints the name
165+
ignored by this command. Unless given `--quiet`, foreach prints the name
157166
of each submodule before evaluating the command.
158-
If --recursive is given, submodules are traversed recursively (i.e.
167+
If `--recursive` is given, submodules are traversed recursively (i.e.
159168
the given shell command is evaluated in nested submodules as well).
160169
A non-zero return from the command in any submodule causes
161170
the processing to terminate. This can be overridden by adding '|| :'
@@ -233,13 +242,18 @@ OPTIONS
233242
If the key `submodule.$name.update` is set to `rebase`, this option is
234243
implicit.
235244

245+
--init::
246+
This option is only valid for the update command.
247+
Initialize all submodules for which "git submodule init" has not been
248+
called so far before updating.
249+
236250
--reference <repository>::
237251
This option is only valid for add and update commands. These
238252
commands sometimes need to clone a remote repository. In this case,
239253
this option will be passed to the linkgit:git-clone[1] command.
240254
+
241255
*NOTE*: Do *not* use this option unless you have read the note
242-
for linkgit:git-clone[1]'s --reference and --shared options carefully.
256+
for linkgit:git-clone[1]'s `--reference` and `--shared` options carefully.
243257

244258
--recursive::
245259
This option is only valid for foreach, update and status commands.

0 commit comments

Comments
 (0)