Skip to content

Commit 2f4e87d

Browse files
committed
Merge branch 'sb/submodule-doc'
Doc updates. * sb/submodule-doc: submodule update documentation: don't repeat ourselves submodule documentation: add options to the subcommand
2 parents 5588dbf + fc01a5d commit 2f4e87d

1 file changed

Lines changed: 25 additions & 32 deletions

File tree

Documentation/git-submodule.txt

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ git-submodule - Initialize, update or inspect submodules
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git submodule' [--quiet] add [-b <branch>] [-f|--force] [--name <name>]
13-
[--reference <repository>] [--depth <depth>] [--] <repository> [<path>]
12+
'git submodule' [--quiet] add [<options>] [--] <repository> [<path>]
1413
'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]
1514
'git submodule' [--quiet] init [--] [<path>...]
1615
'git submodule' [--quiet] deinit [-f|--force] (--all|[--] <path>...)
17-
'git submodule' [--quiet] update [--init] [--remote] [-N|--no-fetch]
18-
[--[no-]recommend-shallow] [-f|--force] [--rebase|--merge]
19-
[--reference <repository>] [--depth <depth>] [--recursive]
20-
[--jobs <n>] [--] [<path>...]
21-
'git submodule' [--quiet] summary [--cached|--files] [(-n|--summary-limit) <n>]
22-
[commit] [--] [<path>...]
16+
'git submodule' [--quiet] update [<options>] [--] [<path>...]
17+
'git submodule' [--quiet] summary [<options>] [--] [<path>...]
2318
'git submodule' [--quiet] foreach [--recursive] <command>
2419
'git submodule' [--quiet] sync [--recursive] [--] [<path>...]
2520
'git submodule' [--quiet] absorbgitdirs [--] [<path>...]
@@ -63,7 +58,7 @@ if you choose to go that route.
6358

6459
COMMANDS
6560
--------
66-
add::
61+
add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--depth <depth>] [--] <repository> [<path>]::
6762
Add the given repository as a submodule at the given path
6863
to the changeset to be committed next to the current
6964
project: the current project is termed the "superproject".
@@ -104,7 +99,7 @@ together in the same relative location, and only the
10499
superproject's URL needs to be provided: git-submodule will correctly
105100
locate the submodule using the relative URL in .gitmodules.
106101

107-
status::
102+
status [--cached] [--recursive] [--] [<path>...]::
108103
Show the status of the submodules. This will print the SHA-1 of the
109104
currently checked out commit for each submodule, along with the
110105
submodule path and the output of 'git describe' for the
@@ -121,7 +116,7 @@ submodules with respect to the commit recorded in the index or the HEAD,
121116
linkgit:git-status[1] and linkgit:git-diff[1] will provide that information
122117
too (and can also report changes to a submodule's work tree).
123118

124-
init::
119+
init [--] [<path>...]::
125120
Initialize the submodules recorded in the index (which were
126121
added and committed elsewhere) by copying submodule
127122
names and urls from .gitmodules to .git/config.
@@ -136,7 +131,7 @@ init::
136131
the explicit 'init' step if you do not intend to customize
137132
any submodule locations.
138133

139-
deinit::
134+
deinit [-f|--force] (--all|[--] <path>...)::
140135
Unregister the given submodules, i.e. remove the whole
141136
`submodule.$name` section from .git/config together with their work
142137
tree. Further calls to `git submodule update`, `git submodule foreach`
@@ -152,44 +147,42 @@ instead of deinit-ing everything, to prevent mistakes.
152147
If `--force` is specified, the submodule's working tree will
153148
be removed even if it contains local modifications.
154149

155-
update::
150+
update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference <repository>] [--depth <depth>] [--recursive] [--jobs <n>] [--] [<path>...]::
156151
+
157152
--
158153
Update the registered submodules to match what the superproject
159154
expects by cloning missing submodules and updating the working tree of
160155
the submodules. The "updating" can be done in several ways depending
161156
on command line options and the value of `submodule.<name>.update`
162-
configuration variable. Supported update procedures are:
157+
configuration variable. The command line option takes precedence over
158+
the configuration variable. if neither is given, a checkout is performed.
159+
update procedures supported both from the command line as well as setting
160+
`submodule.<name>.update`:
163161

164162
checkout;; the commit recorded in the superproject will be
165-
checked out in the submodule on a detached HEAD. This is
166-
done when `--checkout` option is given, or no option is
167-
given, and `submodule.<name>.update` is unset, or if it is
168-
set to 'checkout'.
163+
checked out in the submodule on a detached HEAD.
169164
+
170165
If `--force` is specified, the submodule will be checked out (using
171166
`git checkout --force` if appropriate), even if the commit specified
172167
in the index of the containing repository already matches the commit
173168
checked out in the submodule.
174169

175170
rebase;; the current branch of the submodule will be rebased
176-
onto the commit recorded in the superproject. This is done
177-
when `--rebase` option is given, or no option is given, and
178-
`submodule.<name>.update` is set to 'rebase'.
171+
onto the commit recorded in the superproject.
179172

180173
merge;; the commit recorded in the superproject will be merged
181-
into the current branch in the submodule. This is done
182-
when `--merge` option is given, or no option is given, and
183-
`submodule.<name>.update` is set to 'merge'.
174+
into the current branch in the submodule.
175+
176+
The following procedures are only available via the `submodule.<name>.update`
177+
configuration variable:
184178

185179
custom command;; arbitrary shell command that takes a single
186180
argument (the sha1 of the commit recorded in the
187-
superproject) is executed. This is done when no option is
188-
given, and `submodule.<name>.update` has the form of
189-
'!command'.
181+
superproject) is executed. When `submodule.<name>.update`
182+
is set to '!command', the remainder after the exclamation mark
183+
is the custom command.
190184

191-
When no option is given and `submodule.<name>.update` is set to 'none',
192-
the submodule is not updated.
185+
none;; the submodule is not updated.
193186

194187
If the submodule is not yet initialized, and you just want to use the
195188
setting as stored in .gitmodules, you can automatically initialize the
@@ -198,7 +191,7 @@ submodule with the `--init` option.
198191
If `--recursive` is specified, this command will recurse into the
199192
registered submodules, and update any nested submodules within.
200193
--
201-
summary::
194+
summary [--cached|--files] [(-n|--summary-limit) <n>] [commit] [--] [<path>...]::
202195
Show commit summary between the given commit (defaults to HEAD) and
203196
working tree/index. For a submodule in question, a series of commits
204197
in the submodule between the given super project commit and the
@@ -211,7 +204,7 @@ summary::
211204
Using the `--submodule=log` option with linkgit:git-diff[1] will provide that
212205
information too.
213206

214-
foreach::
207+
foreach [--recursive] <command>::
215208
Evaluates an arbitrary shell command in each checked out submodule.
216209
The command has access to the variables $name, $path, $sha1 and
217210
$toplevel:
@@ -232,7 +225,7 @@ As an example, +git submodule foreach \'echo $path {backtick}git
232225
rev-parse HEAD{backtick}'+ will show the path and currently checked out
233226
commit for each submodule.
234227

235-
sync::
228+
sync [--recursive] [--] [<path>...]::
236229
Synchronizes submodules' remote URL configuration setting
237230
to the value specified in .gitmodules. It will only affect those
238231
submodules which already have a URL entry in .git/config (that is the

0 commit comments

Comments
 (0)