Fixed issue #4133: libgit2 returned: failed to parse revision specifier (ref ending...
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-submodule.xml
blob0dc7312bf121bd445c4784553d3835d60497030d
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">\r
3 \r
4 <sect2 lang="en" id="git-submodule(1)">\r
5     <title>git-submodule(1)</title>\r
6     <date>2023-11-02</date>\r
7 <revhistory><revision><date>2023-11-02</date></revision></revhistory>\r
8 <indexterm>\r
9 <primary>git-submodule(1)</primary>\r
10 </indexterm>\r
11 <simplesect id="git-submodule(1)__name">\r
12 <title>NAME</title>\r
13 <simpara>git-submodule - Initialize, update or inspect submodules</simpara>\r
14 </simplesect>\r
15 <simplesect id="git-submodule(1)__synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <blockquote>\r
18 <literallayout><emphasis>git submodule</emphasis> [--quiet] [--cached]\r
19 <emphasis>git submodule</emphasis> [--quiet] add [&lt;options&gt;] [--] &lt;repository&gt; [&lt;path&gt;]\r
20 <emphasis>git submodule</emphasis> [--quiet] status [--cached] [--recursive] [--] [&lt;path&gt;&#8230;]\r
21 <emphasis>git submodule</emphasis> [--quiet] init [--] [&lt;path&gt;&#8230;]\r
22 <emphasis>git submodule</emphasis> [--quiet] deinit [-f|--force] (--all|[--] &lt;path&gt;&#8230;)\r
23 <emphasis>git submodule</emphasis> [--quiet] update [&lt;options&gt;] [--] [&lt;path&gt;&#8230;]\r
24 <emphasis>git submodule</emphasis> [--quiet] set-branch [&lt;options&gt;] [--] &lt;path&gt;\r
25 <emphasis>git submodule</emphasis> [--quiet] set-url [--] &lt;path&gt; &lt;newurl&gt;\r
26 <emphasis>git submodule</emphasis> [--quiet] summary [&lt;options&gt;] [--] [&lt;path&gt;&#8230;]\r
27 <emphasis>git submodule</emphasis> [--quiet] foreach [--recursive] &lt;command&gt;\r
28 <emphasis>git submodule</emphasis> [--quiet] sync [--recursive] [--] [&lt;path&gt;&#8230;]\r
29 <emphasis>git submodule</emphasis> [--quiet] absorbgitdirs [--] [&lt;path&gt;&#8230;]</literallayout>\r
30 </blockquote>\r
31 </simplesect>\r
32 <simplesect id="git-submodule(1)__description">\r
33 <title>DESCRIPTION</title>\r
34 <simpara>Inspects, updates and manages submodules.</simpara>\r
35 <simpara>For more information about submodules, see <xref linkend="gitsubmodules(7)" />.</simpara>\r
36 </simplesect>\r
37 <simplesect id="git-submodule(1)__commands">\r
38 <title>COMMANDS</title>\r
39 <simpara>With no arguments, shows the status of existing submodules.  Several\r
40 subcommands are available to perform operations on the submodules.</simpara>\r
41 <variablelist>\r
42 <varlistentry>\r
43 <term>\r
44 add [-b &lt;branch&gt;] [-f|--force] [--name &lt;name&gt;] [--reference &lt;repository&gt;] [--depth &lt;depth&gt;] [--] &lt;repository&gt; [&lt;path&gt;]\r
45 </term>\r
46 <listitem>\r
47 <simpara>\r
48         Add the given repository as a submodule at the given path\r
49         to the changeset to be committed next to the current\r
50         project: the current project is termed the "superproject".\r
51 </simpara>\r
52 <simpara>&lt;repository&gt; is the URL of the new submodule's origin repository.\r
53 This may be either an absolute URL, or (if it begins with ./\r
54 or ../), the location relative to the superproject's default remote\r
55 repository (Please note that to specify a repository <emphasis>foo.git</emphasis>\r
56 which is located right next to a superproject <emphasis>bar.git</emphasis>, you'll\r
57 have to use <emphasis>../foo.git</emphasis> instead of <emphasis>./foo.git</emphasis> - as one might expect\r
58 when following the rules for relative URLs - because the evaluation\r
59 of relative URLs in Git is identical to that of relative directories).</simpara>\r
60 <simpara>The default remote is the remote of the remote-tracking branch\r
61 of the current branch. If no such remote-tracking branch exists or\r
62 the HEAD is detached, "origin" is assumed to be the default remote.\r
63 If the superproject doesn't have a default remote configured\r
64 the superproject is its own authoritative upstream and the current\r
65 working directory is used instead.</simpara>\r
66 <simpara>The optional argument &lt;path&gt; is the relative location for the cloned\r
67 submodule to exist in the superproject. If &lt;path&gt; is not given, the\r
68 canonical part of the source repository is used ("repo" for\r
69 "/path/to/repo.git" and "foo" for "host.xz:foo/.git"). If &lt;path&gt;\r
70 exists and is already a valid Git repository, then it is staged\r
71 for commit without cloning. The &lt;path&gt; is also used as the submodule's\r
72 logical name in its configuration entries unless <emphasis>--name</emphasis> is used\r
73 to specify a logical name.</simpara>\r
74 <simpara>The given URL is recorded into <emphasis>.gitmodules</emphasis> for use by subsequent users\r
75 cloning the superproject. If the URL is given relative to the\r
76 superproject's repository, the presumption is the superproject and\r
77 submodule repositories will be kept together in the same relative\r
78 location, and only the superproject's URL needs to be provided.\r
79 git-submodule will correctly locate the submodule using the relative\r
80 URL in <emphasis>.gitmodules</emphasis>.</simpara>\r
81 </listitem>\r
82 </varlistentry>\r
83 <varlistentry>\r
84 <term>\r
85 status [--cached] [--recursive] [--] [&lt;path&gt;&#8230;]\r
86 </term>\r
87 <listitem>\r
88 <simpara>\r
89         Show the status of the submodules. This will print the SHA-1 of the\r
90         currently checked out commit for each submodule, along with the\r
91         submodule path and the output of <emphasis>git describe</emphasis> for the\r
92         SHA-1. Each SHA-1 will possibly be prefixed with <emphasis>-</emphasis> if the submodule is\r
93         not initialized, <emphasis>+</emphasis> if the currently checked out submodule commit\r
94         does not match the SHA-1 found in the index of the containing\r
95         repository and <emphasis>U</emphasis> if the submodule has merge conflicts.\r
96 </simpara>\r
97 <simpara>If <emphasis>--cached</emphasis> is specified, this command will instead print the SHA-1\r
98 recorded in the superproject for each submodule.</simpara>\r
99 <simpara>If <emphasis>--recursive</emphasis> is specified, this command will recurse into nested\r
100 submodules, and show their status as well.</simpara>\r
101 <simpara>If you are only interested in changes of the currently initialized\r
102 submodules with respect to the commit recorded in the index or the HEAD,\r
103 <xref linkend="git-status(1)" /> and <xref linkend="git-diff(1)" /> will provide that information\r
104 too (and can also report changes to a submodule's work tree).</simpara>\r
105 </listitem>\r
106 </varlistentry>\r
107 <varlistentry>\r
108 <term>\r
109 init [--] [&lt;path&gt;&#8230;]\r
110 </term>\r
111 <listitem>\r
112 <simpara>\r
113         Initialize the submodules recorded in the index (which were\r
114         added and committed elsewhere) by setting <emphasis>submodule.$name.url</emphasis>\r
115         in <emphasis>.git/config</emphasis>, using the same setting from <emphasis>.gitmodules</emphasis> as\r
116         a template. If the URL is relative, it will be resolved using\r
117         the default remote. If there is no default remote, the current\r
118         repository will be assumed to be upstream.\r
119 </simpara>\r
120 <simpara>Optional &lt;path&gt; arguments limit which submodules will be initialized.\r
121 If no path is specified and submodule.active has been configured, submodules\r
122 configured to be active will be initialized, otherwise all submodules are\r
123 initialized.</simpara>\r
124 <simpara>It will also copy the value of <emphasis>submodule.$name.update</emphasis>, if present in\r
125 the <emphasis>.gitmodules</emphasis> file, to <emphasis>.git/config</emphasis>, but (1) this command does not\r
126 alter existing information in <emphasis>.git/config</emphasis>, and (2) <emphasis>submodule.$name.update</emphasis>\r
127 that is set to a custom command is <emphasis role="strong">not</emphasis> copied for security reasons.</simpara>\r
128 <simpara>You can then customize the submodule clone URLs in <emphasis>.git/config</emphasis>\r
129 for your local setup and proceed to <emphasis>git submodule update</emphasis>;\r
130 you can also just use <emphasis>git submodule update --init</emphasis> without\r
131 the explicit <emphasis>init</emphasis> step if you do not intend to customize\r
132 any submodule locations.</simpara>\r
133 <simpara>See the add subcommand for the definition of default remote.</simpara>\r
134 </listitem>\r
135 </varlistentry>\r
136 <varlistentry>\r
137 <term>\r
138 deinit [-f|--force] (--all|[--] &lt;path&gt;&#8230;)\r
139 </term>\r
140 <listitem>\r
141 <simpara>\r
142         Unregister the given submodules, i.e. remove the whole\r
143         <emphasis>submodule.$name</emphasis> section from .git/config together with their work\r
144         tree. Further calls to <emphasis>git submodule update</emphasis>, <emphasis>git submodule foreach</emphasis>\r
145         and <emphasis>git submodule sync</emphasis> will skip any unregistered submodules until\r
146         they are initialized again, so use this command if you don't want to\r
147         have a local checkout of the submodule in your working tree anymore.\r
148 </simpara>\r
149 <simpara>When the command is run without pathspec, it errors out,\r
150 instead of deinit-ing everything, to prevent mistakes.</simpara>\r
151 <simpara>If <emphasis>--force</emphasis> is specified, the submodule's working tree will\r
152 be removed even if it contains local modifications.</simpara>\r
153 <simpara>If you really want to remove a submodule from the repository and commit\r
154 that use <xref linkend="git-rm(1)" /> instead. See <xref linkend="gitsubmodules(7)" /> for removal\r
155 options.</simpara>\r
156 </listitem>\r
157 </varlistentry>\r
158 <varlistentry>\r
159 <term>\r
160 update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference &lt;repository&gt;] [--depth &lt;depth&gt;] [--recursive] [--jobs &lt;n&gt;] [--[no-]single-branch] [--filter &lt;filter spec&gt;] [--] [&lt;path&gt;&#8230;]\r
161 </term>\r
162 <listitem>\r
163 <simpara>Update the registered submodules to match what the superproject\r
164 expects by cloning missing submodules, fetching missing commits\r
165 in submodules and updating the working tree of\r
166 the submodules. The "updating" can be done in several ways depending\r
167 on command line options and the value of <emphasis>submodule.&lt;name&gt;.update</emphasis>\r
168 configuration variable. The command line option takes precedence over\r
169 the configuration variable. If neither is given, a <emphasis>checkout</emphasis> is performed.\r
170 (note: what is in <emphasis>.gitmodules</emphasis> file is irrelevant at this point;\r
171 see <emphasis>git submodule init</emphasis> above for how <emphasis>.gitmodules</emphasis> is used).\r
172 The <emphasis>update</emphasis> procedures supported both from the command line as well as\r
173 through the <emphasis>submodule.&lt;name&gt;.update</emphasis> configuration are:</simpara>\r
174 <variablelist>\r
175 <varlistentry>\r
176 <term>\r
177 checkout\r
178 </term>\r
179 <listitem>\r
180 <simpara>\r
181 the commit recorded in the superproject will be\r
182             checked out in the submodule on a detached HEAD.\r
183 </simpara>\r
184 <simpara>If <emphasis>--force</emphasis> is specified, the submodule will be checked out (using\r
185 <emphasis>git checkout --force</emphasis>), even if the commit specified\r
186 in the index of the containing repository already matches the commit\r
187 checked out in the submodule.</simpara>\r
188 </listitem>\r
189 </varlistentry>\r
190 <varlistentry>\r
191 <term>\r
192 rebase\r
193 </term>\r
194 <listitem>\r
195 <simpara>\r
196 the current branch of the submodule will be rebased\r
197             onto the commit recorded in the superproject.\r
198 </simpara>\r
199 </listitem>\r
200 </varlistentry>\r
201 <varlistentry>\r
202 <term>\r
203 merge\r
204 </term>\r
205 <listitem>\r
206 <simpara>\r
207 the commit recorded in the superproject will be merged\r
208             into the current branch in the submodule.\r
209 </simpara>\r
210 </listitem>\r
211 </varlistentry>\r
212 </variablelist>\r
213 <simpara>The following update procedures have additional limitations:</simpara>\r
214 <variablelist>\r
215 <varlistentry>\r
216 <term>\r
217 custom command\r
218 </term>\r
219 <listitem>\r
220 <simpara>\r
221 mechanism for running arbitrary commands with the\r
222             commit ID as an argument. Specifically, if the\r
223             <emphasis>submodule.&lt;name&gt;.update</emphasis> configuration variable is set to\r
224             <emphasis>!custom command</emphasis>, the object name of the commit recorded in the\r
225             superproject for the submodule is appended to the <emphasis>custom command</emphasis>\r
226             string and executed. Note that this mechanism is not supported in\r
227             the <emphasis>.gitmodules</emphasis> file or on the command line.\r
228 </simpara>\r
229 </listitem>\r
230 </varlistentry>\r
231 <varlistentry>\r
232 <term>\r
233 none\r
234 </term>\r
235 <listitem>\r
236 <simpara>\r
237 the submodule is not updated. This update procedure is not\r
238             allowed on the command line.\r
239 </simpara>\r
240 </listitem>\r
241 </varlistentry>\r
242 </variablelist>\r
243 <simpara>If the submodule is not yet initialized, and you just want to use the\r
244 setting as stored in <emphasis>.gitmodules</emphasis>, you can automatically initialize the\r
245 submodule with the <emphasis>--init</emphasis> option.</simpara>\r
246 <simpara>If <emphasis>--recursive</emphasis> is specified, this command will recurse into the\r
247 registered submodules, and update any nested submodules within.</simpara>\r
248 <simpara>If <emphasis>--filter &lt;filter spec&gt;</emphasis> is specified, the given partial clone filter will be\r
249 applied to the submodule. See <xref linkend="git-rev-list(1)" /> for details on filter\r
250 specifications.</simpara>\r
251 </listitem>\r
252 </varlistentry>\r
253 <varlistentry>\r
254 <term>\r
255 set-branch (-b|--branch) &lt;branch&gt; [--] &lt;path&gt;\r
256 </term>\r
257 <term>\r
258 set-branch (-d|--default) [--] &lt;path&gt;\r
259 </term>\r
260 <listitem>\r
261 <simpara>\r
262         Sets the default remote tracking branch for the submodule. The\r
263         <emphasis>--branch</emphasis> option allows the remote branch to be specified. The\r
264         <emphasis>--default</emphasis> option removes the submodule.&lt;name&gt;.branch configuration\r
265         key, which causes the tracking branch to default to the remote <emphasis>HEAD</emphasis>.\r
266 </simpara>\r
267 </listitem>\r
268 </varlistentry>\r
269 <varlistentry>\r
270 <term>\r
271 set-url [--] &lt;path&gt; &lt;newurl&gt;\r
272 </term>\r
273 <listitem>\r
274 <simpara>\r
275         Sets the URL of the specified submodule to &lt;newurl&gt;. Then, it will\r
276         automatically synchronize the submodule's new remote URL\r
277         configuration.\r
278 </simpara>\r
279 </listitem>\r
280 </varlistentry>\r
281 <varlistentry>\r
282 <term>\r
283 summary [--cached|--files] [(-n|--summary-limit) &lt;n&gt;] [commit] [--] [&lt;path&gt;&#8230;]\r
284 </term>\r
285 <listitem>\r
286 <simpara>\r
287         Show commit summary between the given commit (defaults to HEAD) and\r
288         working tree/index. For a submodule in question, a series of commits\r
289         in the submodule between the given super project commit and the\r
290         index or working tree (switched by <emphasis>--cached</emphasis>) are shown. If the option\r
291         <emphasis>--files</emphasis> is given, show the series of commits in the submodule between\r
292         the index of the super project and the working tree of the submodule\r
293         (this option doesn't allow to use the <emphasis>--cached</emphasis> option or to provide an\r
294         explicit commit).\r
295 </simpara>\r
296 <simpara>Using the <emphasis>--submodule=log</emphasis> option with <xref linkend="git-diff(1)" /> will provide that\r
297 information too.</simpara>\r
298 </listitem>\r
299 </varlistentry>\r
300 <varlistentry>\r
301 <term>\r
302 foreach [--recursive] &lt;command&gt;\r
303 </term>\r
304 <listitem>\r
305 <simpara>\r
306         Evaluates an arbitrary shell command in each checked out submodule.\r
307         The command has access to the variables $name, $sm_path, $displaypath,\r
308         $sha1 and $toplevel:\r
309         $name is the name of the relevant submodule section in <emphasis>.gitmodules</emphasis>,\r
310         $sm_path is the path of the submodule as recorded in the immediate\r
311         superproject, $displaypath contains the relative path from the\r
312         current working directory to the submodules root directory,\r
313         $sha1 is the commit as recorded in the immediate\r
314         superproject, and $toplevel is the absolute path to the top-level\r
315         of the immediate superproject.\r
316         Note that to avoid conflicts with <emphasis>$PATH</emphasis> on Windows, the <emphasis>$path</emphasis>\r
317         variable is now a deprecated synonym of <emphasis>$sm_path</emphasis> variable.\r
318         Any submodules defined in the superproject but not checked out are\r
319         ignored by this command. Unless given <emphasis>--quiet</emphasis>, foreach prints the name\r
320         of each submodule before evaluating the command.\r
321         If <emphasis>--recursive</emphasis> is given, submodules are traversed recursively (i.e.\r
322         the given shell command is evaluated in nested submodules as well).\r
323         A non-zero return from the command in any submodule causes\r
324         the processing to terminate. This can be overridden by adding <emphasis>|| :</emphasis>\r
325         to the end of the command.\r
326 </simpara>\r
327 <simpara>As an example, the command below will show the path and currently\r
328 checked out commit for each submodule:</simpara>\r
329 <screen>git submodule foreach 'echo $sm_path `git rev-parse HEAD`'</screen>\r
330 </listitem>\r
331 </varlistentry>\r
332 <varlistentry>\r
333 <term>\r
334 sync [--recursive] [--] [&lt;path&gt;&#8230;]\r
335 </term>\r
336 <listitem>\r
337 <simpara>\r
338         Synchronizes submodules' remote URL configuration setting\r
339         to the value specified in <emphasis>.gitmodules</emphasis>. It will only affect those\r
340         submodules which already have a URL entry in .git/config (that is the\r
341         case when they are initialized or freshly added). This is useful when\r
342         submodule URLs change upstream and you need to update your local\r
343         repositories accordingly.\r
344 </simpara>\r
345 <simpara><emphasis>git submodule sync</emphasis> synchronizes all submodules while\r
346 <emphasis>git submodule sync -- A</emphasis> synchronizes submodule "A" only.</simpara>\r
347 <simpara>If <emphasis>--recursive</emphasis> is specified, this command will recurse into the\r
348 registered submodules, and sync any nested submodules within.</simpara>\r
349 </listitem>\r
350 </varlistentry>\r
351 <varlistentry>\r
352 <term>\r
353 absorbgitdirs\r
354 </term>\r
355 <listitem>\r
356 <simpara>\r
357         If a git directory of a submodule is inside the submodule,\r
358         move the git directory of the submodule into its superproject's\r
359         <emphasis>$GIT_DIR/modules</emphasis> path and then connect the git directory and\r
360         its working directory by setting the <emphasis>core.worktree</emphasis> and adding\r
361         a .git file pointing to the git directory embedded in the\r
362         superprojects git directory.\r
363 </simpara>\r
364 <simpara>A repository that was cloned independently and later added as a submodule or\r
365 old setups have the submodules git directory inside the submodule instead of\r
366 embedded into the superprojects git directory.</simpara>\r
367 <simpara>This command is recursive by default.</simpara>\r
368 </listitem>\r
369 </varlistentry>\r
370 </variablelist>\r
371 </simplesect>\r
372 <simplesect id="git-submodule(1)__options">\r
373 <title>OPTIONS</title>\r
374 <variablelist>\r
375 <varlistentry>\r
376 <term>\r
377 -q\r
378 </term>\r
379 <term>\r
380 --quiet\r
381 </term>\r
382 <listitem>\r
383 <simpara>\r
384         Only print error messages.\r
385 </simpara>\r
386 </listitem>\r
387 </varlistentry>\r
388 <varlistentry>\r
389 <term>\r
390 --progress\r
391 </term>\r
392 <listitem>\r
393 <simpara>\r
394         This option is only valid for add and update commands.\r
395         Progress status is reported on the standard error stream\r
396         by default when it is attached to a terminal, unless -q\r
397         is specified. This flag forces progress status even if the\r
398         standard error stream is not directed to a terminal.\r
399 </simpara>\r
400 </listitem>\r
401 </varlistentry>\r
402 <varlistentry>\r
403 <term>\r
404 --all\r
405 </term>\r
406 <listitem>\r
407 <simpara>\r
408         This option is only valid for the deinit command. Unregister all\r
409         submodules in the working tree.\r
410 </simpara>\r
411 </listitem>\r
412 </varlistentry>\r
413 <varlistentry>\r
414 <term>\r
415 -b &lt;branch&gt;\r
416 </term>\r
417 <term>\r
418 --branch &lt;branch&gt;\r
419 </term>\r
420 <listitem>\r
421 <simpara>\r
422         Branch of repository to add as submodule.\r
423         The name of the branch is recorded as <emphasis>submodule.&lt;name&gt;.branch</emphasis> in\r
424         <emphasis>.gitmodules</emphasis> for <emphasis>update --remote</emphasis>.  A special value of <emphasis>.</emphasis> is used to\r
425         indicate that the name of the branch in the submodule should be the\r
426         same name as the current branch in the current repository.  If the\r
427         option is not specified, it defaults to the remote <emphasis>HEAD</emphasis>.\r
428 </simpara>\r
429 </listitem>\r
430 </varlistentry>\r
431 <varlistentry>\r
432 <term>\r
433 -f\r
434 </term>\r
435 <term>\r
436 --force\r
437 </term>\r
438 <listitem>\r
439 <simpara>\r
440         This option is only valid for add, deinit and update commands.\r
441         When running add, allow adding an otherwise ignored submodule path.\r
442         When running deinit the submodule working trees will be removed even\r
443         if they contain local changes.\r
444         When running update (only effective with the checkout procedure),\r
445         throw away local changes in submodules when switching to a\r
446         different commit; and always run a checkout operation in the\r
447         submodule, even if the commit listed in the index of the\r
448         containing repository matches the commit checked out in the\r
449         submodule.\r
450 </simpara>\r
451 </listitem>\r
452 </varlistentry>\r
453 <varlistentry>\r
454 <term>\r
455 --cached\r
456 </term>\r
457 <listitem>\r
458 <simpara>\r
459         This option is only valid for status and summary commands.  These\r
460         commands typically use the commit found in the submodule HEAD, but\r
461         with this option, the commit stored in the index is used instead.\r
462 </simpara>\r
463 </listitem>\r
464 </varlistentry>\r
465 <varlistentry>\r
466 <term>\r
467 --files\r
468 </term>\r
469 <listitem>\r
470 <simpara>\r
471         This option is only valid for the summary command. This command\r
472         compares the commit in the index with that in the submodule HEAD\r
473         when this option is used.\r
474 </simpara>\r
475 </listitem>\r
476 </varlistentry>\r
477 <varlistentry>\r
478 <term>\r
479 -n\r
480 </term>\r
481 <term>\r
482 --summary-limit\r
483 </term>\r
484 <listitem>\r
485 <simpara>\r
486         This option is only valid for the summary command.\r
487         Limit the summary size (number of commits shown in total).\r
488         Giving 0 will disable the summary; a negative number means unlimited\r
489         (the default). This limit only applies to modified submodules. The\r
490         size is always limited to 1 for added/deleted/typechanged submodules.\r
491 </simpara>\r
492 </listitem>\r
493 </varlistentry>\r
494 <varlistentry>\r
495 <term>\r
496 --remote\r
497 </term>\r
498 <listitem>\r
499 <simpara>\r
500         This option is only valid for the update command.  Instead of using\r
501         the superproject's recorded SHA-1 to update the submodule, use the\r
502         status of the submodule's remote-tracking branch.  The remote used\r
503         is branch's remote (<emphasis>branch.&lt;name&gt;.remote</emphasis>), defaulting to <emphasis>origin</emphasis>.\r
504         The remote branch used defaults to the remote <emphasis>HEAD</emphasis>, but the branch\r
505         name may be overridden by setting the <emphasis>submodule.&lt;name&gt;.branch</emphasis>\r
506         option in either <emphasis>.gitmodules</emphasis> or <emphasis>.git/config</emphasis> (with <emphasis>.git/config</emphasis>\r
507         taking precedence).\r
508 </simpara>\r
509 <simpara>This works for any of the supported update procedures (<emphasis>--checkout</emphasis>,\r
510 <emphasis>--rebase</emphasis>, etc.).  The only change is the source of the target SHA-1.\r
511 For example, <emphasis>submodule update --remote --merge</emphasis> will merge upstream\r
512 submodule changes into the submodules, while <emphasis>submodule update\r
513 --merge</emphasis> will merge superproject gitlink changes into the submodules.</simpara>\r
514 <simpara>In order to ensure a current tracking branch state, <emphasis>update --remote</emphasis>\r
515 fetches the submodule's remote repository before calculating the\r
516 SHA-1.  If you don't want to fetch, you should use <emphasis>submodule update\r
517 --remote --no-fetch</emphasis>.</simpara>\r
518 <simpara>Use this option to integrate changes from the upstream subproject with\r
519 your submodule's current HEAD.  Alternatively, you can run <emphasis>git pull</emphasis>\r
520 from the submodule, which is equivalent except for the remote branch\r
521 name: <emphasis>update --remote</emphasis> uses the default upstream repository and\r
522 <emphasis>submodule.&lt;name&gt;.branch</emphasis>, while <emphasis>git pull</emphasis> uses the submodule's\r
523 <emphasis>branch.&lt;name&gt;.merge</emphasis>.  Prefer <emphasis>submodule.&lt;name&gt;.branch</emphasis> if you want\r
524 to distribute the default upstream branch with the superproject and\r
525 <emphasis>branch.&lt;name&gt;.merge</emphasis> if you want a more native feel while working in\r
526 the submodule itself.</simpara>\r
527 </listitem>\r
528 </varlistentry>\r
529 <varlistentry>\r
530 <term>\r
531 -N\r
532 </term>\r
533 <term>\r
534 --no-fetch\r
535 </term>\r
536 <listitem>\r
537 <simpara>\r
538         This option is only valid for the update command.\r
539         Don't fetch new objects from the remote site.\r
540 </simpara>\r
541 </listitem>\r
542 </varlistentry>\r
543 <varlistentry>\r
544 <term>\r
545 --checkout\r
546 </term>\r
547 <listitem>\r
548 <simpara>\r
549         This option is only valid for the update command.\r
550         Checkout the commit recorded in the superproject on a detached HEAD\r
551         in the submodule. This is the default behavior, the main use of\r
552         this option is to override <emphasis>submodule.$name.update</emphasis> when set to\r
553         a value other than <emphasis>checkout</emphasis>.\r
554         If the key <emphasis>submodule.$name.update</emphasis> is either not explicitly set or\r
555         set to <emphasis>checkout</emphasis>, this option is implicit.\r
556 </simpara>\r
557 </listitem>\r
558 </varlistentry>\r
559 <varlistentry>\r
560 <term>\r
561 --merge\r
562 </term>\r
563 <listitem>\r
564 <simpara>\r
565         This option is only valid for the update command.\r
566         Merge the commit recorded in the superproject into the current branch\r
567         of the submodule. If this option is given, the submodule's HEAD will\r
568         not be detached. If a merge failure prevents this process, you will\r
569         have to resolve the resulting conflicts within the submodule with the\r
570         usual conflict resolution tools.\r
571         If the key <emphasis>submodule.$name.update</emphasis> is set to <emphasis>merge</emphasis>, this option is\r
572         implicit.\r
573 </simpara>\r
574 </listitem>\r
575 </varlistentry>\r
576 <varlistentry>\r
577 <term>\r
578 --rebase\r
579 </term>\r
580 <listitem>\r
581 <simpara>\r
582         This option is only valid for the update command.\r
583         Rebase the current branch onto the commit recorded in the\r
584         superproject. If this option is given, the submodule's HEAD will not\r
585         be detached. If a merge failure prevents this process, you will have\r
586         to resolve these failures with <xref linkend="git-rebase(1)" />.\r
587         If the key <emphasis>submodule.$name.update</emphasis> is set to <emphasis>rebase</emphasis>, this option is\r
588         implicit.\r
589 </simpara>\r
590 </listitem>\r
591 </varlistentry>\r
592 <varlistentry>\r
593 <term>\r
594 --init\r
595 </term>\r
596 <listitem>\r
597 <simpara>\r
598         This option is only valid for the update command.\r
599         Initialize all submodules for which "git submodule init" has not been\r
600         called so far before updating.\r
601 </simpara>\r
602 </listitem>\r
603 </varlistentry>\r
604 <varlistentry>\r
605 <term>\r
606 --name\r
607 </term>\r
608 <listitem>\r
609 <simpara>\r
610         This option is only valid for the add command. It sets the submodule's\r
611         name to the given string instead of defaulting to its path. The name\r
612         must be valid as a directory name and may not end with a <emphasis>/</emphasis>.\r
613 </simpara>\r
614 </listitem>\r
615 </varlistentry>\r
616 <varlistentry>\r
617 <term>\r
618 --reference &lt;repository&gt;\r
619 </term>\r
620 <listitem>\r
621 <simpara>\r
622         This option is only valid for add and update commands.  These\r
623         commands sometimes need to clone a remote repository. In this case,\r
624         this option will be passed to the <xref linkend="git-clone(1)" /> command.\r
625 </simpara>\r
626 <simpara><emphasis role="strong">NOTE</emphasis>: Do <emphasis role="strong">not</emphasis> use this option unless you have read the note\r
627 for <xref linkend="git-clone(1)" />'s <emphasis>--reference</emphasis>, <emphasis>--shared</emphasis>, and <emphasis>--dissociate</emphasis>\r
628 options carefully.</simpara>\r
629 </listitem>\r
630 </varlistentry>\r
631 <varlistentry>\r
632 <term>\r
633 --dissociate\r
634 </term>\r
635 <listitem>\r
636 <simpara>\r
637         This option is only valid for add and update commands.  These\r
638         commands sometimes need to clone a remote repository. In this case,\r
639         this option will be passed to the <xref linkend="git-clone(1)" /> command.\r
640 </simpara>\r
641 <simpara><emphasis role="strong">NOTE</emphasis>: see the NOTE for the <emphasis>--reference</emphasis> option.</simpara>\r
642 </listitem>\r
643 </varlistentry>\r
644 <varlistentry>\r
645 <term>\r
646 --recursive\r
647 </term>\r
648 <listitem>\r
649 <simpara>\r
650         This option is only valid for foreach, update, status and sync commands.\r
651         Traverse submodules recursively. The operation is performed not\r
652         only in the submodules of the current repo, but also\r
653         in any nested submodules inside those submodules (and so on).\r
654 </simpara>\r
655 </listitem>\r
656 </varlistentry>\r
657 <varlistentry>\r
658 <term>\r
659 --depth\r
660 </term>\r
661 <listitem>\r
662 <simpara>\r
663         This option is valid for add and update commands. Create a <emphasis>shallow</emphasis>\r
664         clone with a history truncated to the specified number of revisions.\r
665         See <xref linkend="git-clone(1)" />\r
666 </simpara>\r
667 </listitem>\r
668 </varlistentry>\r
669 <varlistentry>\r
670 <term>\r
671 --[no-]recommend-shallow\r
672 </term>\r
673 <listitem>\r
674 <simpara>\r
675         This option is only valid for the update command.\r
676         The initial clone of a submodule will use the recommended\r
677         <emphasis>submodule.&lt;name&gt;.shallow</emphasis> as provided by the <emphasis>.gitmodules</emphasis> file\r
678         by default. To ignore the suggestions use <emphasis>--no-recommend-shallow</emphasis>.\r
679 </simpara>\r
680 </listitem>\r
681 </varlistentry>\r
682 <varlistentry>\r
683 <term>\r
684 -j &lt;n&gt;\r
685 </term>\r
686 <term>\r
687 --jobs &lt;n&gt;\r
688 </term>\r
689 <listitem>\r
690 <simpara>\r
691         This option is only valid for the update command.\r
692         Clone new submodules in parallel with as many jobs.\r
693         Defaults to the <emphasis>submodule.fetchJobs</emphasis> option.\r
694 </simpara>\r
695 </listitem>\r
696 </varlistentry>\r
697 <varlistentry>\r
698 <term>\r
699 --[no-]single-branch\r
700 </term>\r
701 <listitem>\r
702 <simpara>\r
703         This option is only valid for the update command.\r
704         Clone only one branch during update: HEAD or one specified by --branch.\r
705 </simpara>\r
706 </listitem>\r
707 </varlistentry>\r
708 <varlistentry>\r
709 <term>\r
710 &lt;path&gt;&#8230;\r
711 </term>\r
712 <listitem>\r
713 <simpara>\r
714         Paths to submodule(s). When specified this will restrict the command\r
715         to only operate on the submodules found at the specified paths.\r
716         (This argument is required with add).\r
717 </simpara>\r
718 </listitem>\r
719 </varlistentry>\r
720 </variablelist>\r
721 </simplesect>\r
722 <simplesect id="git-submodule(1)__files">\r
723 <title>FILES</title>\r
724 <simpara>When initializing submodules, a <emphasis>.gitmodules</emphasis> file in the top-level directory\r
725 of the containing repository is used to find the url of each submodule.\r
726 This file should be formatted in the same way as <emphasis>$GIT_DIR/config</emphasis>. The key\r
727 to each submodule url is "submodule.$name.url".  See <xref linkend="gitmodules(5)" />\r
728 for details.</simpara>\r
729 </simplesect>\r
730 <simplesect id="git-submodule(1)__see_also">\r
731 <title>SEE ALSO</title>\r
732 <simpara><xref linkend="gitsubmodules(7)" />, <xref linkend="gitmodules(5)" />.</simpara>\r
733 </simplesect>\r
734 <simplesect id="git-submodule(1)__git">\r
735 <title>GIT</title>\r
736 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
737 </simplesect>\r
738 </sect2>\r