Autogenerated HTML docs for v1.7.4-15-g7811
[git/jnareb-git.git] / git-submodule.html
blob714027cfcb9bdcff833b49bef28f0e69f178559a
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-submodule(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-submodule(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-submodule -
411 Initialize, update or inspect submodules
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="verseblock">
418 <div class="verseblock-content"><em>git submodule</em> [--quiet] add [-b branch] [-f|--force]
419 [--reference &lt;repository&gt;] [--] &lt;repository&gt; [&lt;path&gt;]
420 <em>git submodule</em> [--quiet] status [--cached] [--recursive] [--] [&lt;path&gt;&#8230;]
421 <em>git submodule</em> [--quiet] init [--] [&lt;path&gt;&#8230;]
422 <em>git submodule</em> [--quiet] update [--init] [-N|--no-fetch] [--rebase]
423 [--reference &lt;repository&gt;] [--merge] [--recursive] [--] [&lt;path&gt;&#8230;]
424 <em>git submodule</em> [--quiet] summary [--cached|--files] [--summary-limit &lt;n&gt;] [commit] [--] [&lt;path&gt;&#8230;]
425 <em>git submodule</em> [--quiet] foreach [--recursive] &lt;command&gt;
426 <em>git submodule</em> [--quiet] sync [--] [&lt;path&gt;&#8230;]</div>
427 <div class="verseblock-attribution">
428 </div></div>
429 </div>
430 <h2 id="_description">DESCRIPTION</h2>
431 <div class="sectionbody">
432 <div class="paragraph"><p>Submodules allow foreign repositories to be embedded within
433 a dedicated subdirectory of the source tree, always pointed
434 at a particular commit.</p></div>
435 <div class="paragraph"><p>They are not to be confused with remotes, which are meant mainly
436 for branches of the same project; submodules are meant for
437 different projects you would like to make part of your source tree,
438 while the history of the two projects still stays completely
439 independent and you cannot modify the contents of the submodule
440 from within the main project.
441 If you want to merge the project histories and want to treat the
442 aggregated whole as a single project from then on, you may want to
443 add a remote for the other project and use the <em>subtree</em> merge strategy,
444 instead of treating the other project as a submodule. Directories
445 that come from both projects can be cloned and checked out as a whole
446 if you choose to go that route.</p></div>
447 <div class="paragraph"><p>Submodules are composed from a so-called <tt>gitlink</tt> tree entry
448 in the main repository that refers to a particular commit object
449 within the inner repository that is completely separate.
450 A record in the <tt>.gitmodules</tt> file at the root of the source
451 tree assigns a logical name to the submodule and describes
452 the default URL the submodule shall be cloned from.
453 The logical name can be used for overriding this URL within your
454 local repository configuration (see <em>submodule init</em>).</p></div>
455 <div class="paragraph"><p>This command will manage the tree entries and contents of the
456 gitmodules file for you, as well as inspect the status of your
457 submodules and update them.
458 When adding a new submodule to the tree, the <em>add</em> subcommand
459 is to be used. However, when pulling a tree containing submodules,
460 these will not be checked out by default;
461 the <em>init</em> and <em>update</em> subcommands will maintain submodules
462 checked out and at appropriate revision in your working tree.
463 You can briefly inspect the up-to-date status of your submodules
464 using the <em>status</em> subcommand and get a detailed overview of the
465 difference between the index and checkouts using the <em>summary</em>
466 subcommand.</p></div>
467 </div>
468 <h2 id="_commands">COMMANDS</h2>
469 <div class="sectionbody">
470 <div class="dlist"><dl>
471 <dt class="hdlist1">
473 </dt>
474 <dd>
476 Add the given repository as a submodule at the given path
477 to the changeset to be committed next to the current
478 project: the current project is termed the "superproject".
479 </p>
480 <div class="paragraph"><p>This requires at least one argument: &lt;repository&gt;. The optional
481 argument &lt;path&gt; is the relative location for the cloned submodule
482 to exist in the superproject. If &lt;path&gt; is not given, the
483 "humanish" part of the source repository is used ("repo" for
484 "/path/to/repo.git" and "foo" for "host.xz:foo/.git").</p></div>
485 <div class="paragraph"><p>&lt;repository&gt; is the URL of the new submodule&#8217;s origin repository.
486 This may be either an absolute URL, or (if it begins with ./
487 or ../), the location relative to the superproject&#8217;s origin
488 repository.</p></div>
489 <div class="paragraph"><p>&lt;path&gt; is the relative location for the cloned submodule to
490 exist in the superproject. If &lt;path&gt; does not exist, then the
491 submodule is created by cloning from the named URL. If &lt;path&gt; does
492 exist and is already a valid git repository, then this is added
493 to the changeset without cloning. This second form is provided
494 to ease creating a new submodule from scratch, and presumes
495 the user will later push the submodule to the given URL.</p></div>
496 <div class="paragraph"><p>In either case, the given URL is recorded into .gitmodules for
497 use by subsequent users cloning the superproject. If the URL is
498 given relative to the superproject&#8217;s repository, the presumption
499 is the superproject and submodule repositories will be kept
500 together in the same relative location, and only the
501 superproject&#8217;s URL needs to be provided: git-submodule will correctly
502 locate the submodule using the relative URL in .gitmodules.</p></div>
503 </dd>
504 <dt class="hdlist1">
505 status
506 </dt>
507 <dd>
509 Show the status of the submodules. This will print the SHA-1 of the
510 currently checked out commit for each submodule, along with the
511 submodule path and the output of <em>git describe</em> for the
512 SHA-1. Each SHA-1 will be prefixed with <tt>-</tt> if the submodule is not
513 initialized and <tt>+</tt> if the currently checked out submodule commit
514 does not match the SHA-1 found in the index of the containing
515 repository. This command is the default command for <em>git submodule</em>.
516 </p>
517 <div class="paragraph"><p>If <em>--recursive</em> is specified, this command will recurse into nested
518 submodules, and show their status as well.</p></div>
519 </dd>
520 <dt class="hdlist1">
521 init
522 </dt>
523 <dd>
525 Initialize the submodules, i.e. register each submodule name
526 and url found in .gitmodules into .git/config.
527 The key used in .git/config is <tt>submodule.$name.url</tt>.
528 This command does not alter existing information in .git/config.
529 You can then customize the submodule clone URLs in .git/config
530 for your local setup and proceed to <tt>git submodule update</tt>;
531 you can also just use <tt>git submodule update --init</tt> without
532 the explicit <em>init</em> step if you do not intend to customize
533 any submodule locations.
534 </p>
535 </dd>
536 <dt class="hdlist1">
537 update
538 </dt>
539 <dd>
541 Update the registered submodules, i.e. clone missing submodules and
542 checkout the commit specified in the index of the containing repository.
543 This will make the submodules HEAD be detached unless <em>--rebase</em> or
544 <em>--merge</em> is specified or the key <tt>submodule.$name.update</tt> is set to
545 <tt>rebase</tt> or <tt>merge</tt>.
546 </p>
547 <div class="paragraph"><p>If the submodule is not yet initialized, and you just want to use the
548 setting as stored in .gitmodules, you can automatically initialize the
549 submodule with the --init option.</p></div>
550 <div class="paragraph"><p>If <em>--recursive</em> is specified, this command will recurse into the
551 registered submodules, and update any nested submodules within.</p></div>
552 </dd>
553 <dt class="hdlist1">
554 summary
555 </dt>
556 <dd>
558 Show commit summary between the given commit (defaults to HEAD) and
559 working tree/index. For a submodule in question, a series of commits
560 in the submodule between the given super project commit and the
561 index or working tree (switched by --cached) are shown. If the option
562 --files is given, show the series of commits in the submodule between
563 the index of the super project and the working tree of the submodule
564 (this option doesn&#8217;t allow to use the --cached option or to provide an
565 explicit commit).
566 </p>
567 </dd>
568 <dt class="hdlist1">
569 foreach
570 </dt>
571 <dd>
573 Evaluates an arbitrary shell command in each checked out submodule.
574 The command has access to the variables $name, $path, $sha1 and
575 $toplevel:
576 $name is the name of the relevant submodule section in .gitmodules,
577 $path is the name of the submodule directory relative to the
578 superproject, $sha1 is the commit as recorded in the superproject,
579 and $toplevel is the absolute path to the top-level of the superproject.
580 Any submodules defined in the superproject but not checked out are
581 ignored by this command. Unless given --quiet, foreach prints the name
582 of each submodule before evaluating the command.
583 If --recursive is given, submodules are traversed recursively (i.e.
584 the given shell command is evaluated in nested submodules as well).
585 A non-zero return from the command in any submodule causes
586 the processing to terminate. This can be overridden by adding <em>|| :</em>
587 to the end of the command.
588 </p>
589 <div class="paragraph"><p>As an example, <tt>git submodule foreach 'echo $path &#96;git
590 rev-parse HEAD&#96;'</tt> will show the path and currently checked out
591 commit for each submodule.</p></div>
592 </dd>
593 <dt class="hdlist1">
594 sync
595 </dt>
596 <dd>
598 Synchronizes submodules' remote URL configuration setting
599 to the value specified in .gitmodules. This is useful when
600 submodule URLs change upstream and you need to update your local
601 repositories accordingly.
602 </p>
603 <div class="paragraph"><p>"git submodule sync" synchronizes all submodules while
604 "git submodule sync&#8201;&#8212;&#8201;A" synchronizes submodule "A" only.</p></div>
605 </dd>
606 </dl></div>
607 </div>
608 <h2 id="_options">OPTIONS</h2>
609 <div class="sectionbody">
610 <div class="dlist"><dl>
611 <dt class="hdlist1">
613 </dt>
614 <dt class="hdlist1">
615 --quiet
616 </dt>
617 <dd>
619 Only print error messages.
620 </p>
621 </dd>
622 <dt class="hdlist1">
624 </dt>
625 <dt class="hdlist1">
626 --branch
627 </dt>
628 <dd>
630 Branch of repository to add as submodule.
631 </p>
632 </dd>
633 <dt class="hdlist1">
635 </dt>
636 <dt class="hdlist1">
637 --force
638 </dt>
639 <dd>
641 This option is only valid for the add command.
642 Allow adding an otherwise ignored submodule path.
643 </p>
644 </dd>
645 <dt class="hdlist1">
646 --cached
647 </dt>
648 <dd>
650 This option is only valid for status and summary commands. These
651 commands typically use the commit found in the submodule HEAD, but
652 with this option, the commit stored in the index is used instead.
653 </p>
654 </dd>
655 <dt class="hdlist1">
656 --files
657 </dt>
658 <dd>
660 This option is only valid for the summary command. This command
661 compares the commit in the index with that in the submodule HEAD
662 when this option is used.
663 </p>
664 </dd>
665 <dt class="hdlist1">
667 </dt>
668 <dt class="hdlist1">
669 --summary-limit
670 </dt>
671 <dd>
673 This option is only valid for the summary command.
674 Limit the summary size (number of commits shown in total).
675 Giving 0 will disable the summary; a negative number means unlimited
676 (the default). This limit only applies to modified submodules. The
677 size is always limited to 1 for added/deleted/typechanged submodules.
678 </p>
679 </dd>
680 <dt class="hdlist1">
682 </dt>
683 <dt class="hdlist1">
684 --no-fetch
685 </dt>
686 <dd>
688 This option is only valid for the update command.
689 Don&#8217;t fetch new objects from the remote site.
690 </p>
691 </dd>
692 <dt class="hdlist1">
693 --merge
694 </dt>
695 <dd>
697 This option is only valid for the update command.
698 Merge the commit recorded in the superproject into the current branch
699 of the submodule. If this option is given, the submodule&#8217;s HEAD will
700 not be detached. If a merge failure prevents this process, you will
701 have to resolve the resulting conflicts within the submodule with the
702 usual conflict resolution tools.
703 If the key <tt>submodule.$name.update</tt> is set to <tt>merge</tt>, this option is
704 implicit.
705 </p>
706 </dd>
707 <dt class="hdlist1">
708 --rebase
709 </dt>
710 <dd>
712 This option is only valid for the update command.
713 Rebase the current branch onto the commit recorded in the
714 superproject. If this option is given, the submodule&#8217;s HEAD will not
715 be detached. If a merge failure prevents this process, you will have
716 to resolve these failures with <a href="git-rebase.html">git-rebase(1)</a>.
717 If the key <tt>submodule.$name.update</tt> is set to <tt>rebase</tt>, this option is
718 implicit.
719 </p>
720 </dd>
721 <dt class="hdlist1">
722 --reference &lt;repository&gt;
723 </dt>
724 <dd>
726 This option is only valid for add and update commands. These
727 commands sometimes need to clone a remote repository. In this case,
728 this option will be passed to the <a href="git-clone.html">git-clone(1)</a> command.
729 </p>
730 <div class="paragraph"><p><strong>NOTE</strong>: Do <strong>not</strong> use this option unless you have read the note
731 for <a href="git-clone.html">git-clone(1)</a>'s --reference and --shared options carefully.</p></div>
732 </dd>
733 <dt class="hdlist1">
734 --recursive
735 </dt>
736 <dd>
738 This option is only valid for foreach, update and status commands.
739 Traverse submodules recursively. The operation is performed not
740 only in the submodules of the current repo, but also
741 in any nested submodules inside those submodules (and so on).
742 </p>
743 </dd>
744 <dt class="hdlist1">
745 &lt;path&gt;&#8230;
746 </dt>
747 <dd>
749 Paths to submodule(s). When specified this will restrict the command
750 to only operate on the submodules found at the specified paths.
751 (This argument is required with add).
752 </p>
753 </dd>
754 </dl></div>
755 </div>
756 <h2 id="_files">FILES</h2>
757 <div class="sectionbody">
758 <div class="paragraph"><p>When initializing submodules, a .gitmodules file in the top-level directory
759 of the containing repository is used to find the url of each submodule.
760 This file should be formatted in the same way as <tt>$GIT_DIR/config</tt>. The key
761 to each submodule url is "submodule.$name.url". See <a href="gitmodules.html">gitmodules(5)</a>
762 for details.</p></div>
763 </div>
764 <h2 id="_author">AUTHOR</h2>
765 <div class="sectionbody">
766 <div class="paragraph"><p>Written by Lars Hjemli &lt;<a href="mailto:hjemli@gmail.com">hjemli@gmail.com</a>&gt;</p></div>
767 </div>
768 <h2 id="_git">GIT</h2>
769 <div class="sectionbody">
770 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
771 </div>
772 <div id="footer">
773 <div id="footer-text">
774 Last updated 2010-07-19 20:25:56 UTC
775 </div>
776 </div>
777 </body>
778 </html>