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