Autogenerated HTML docs for v2.43.0-440-gb50a60
[git-htmldocs.git] / git-submodule.html
blob5ca592e050ca619dfde8bebf239ca3cbc2f45836
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>git-submodule(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
228 div.imageblock div.content { padding-left: 0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
552 * Version: 0.4
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 git-submodule(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-submodule -
743 Initialize, update or inspect submodules
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content"><em>git submodule</em> [--quiet] [--cached]
753 <em>git submodule</em> [--quiet] add [&lt;options&gt;] [--] &lt;repository&gt; [&lt;path&gt;]
754 <em>git submodule</em> [--quiet] status [--cached] [--recursive] [--] [&lt;path&gt;&#8230;]
755 <em>git submodule</em> [--quiet] init [--] [&lt;path&gt;&#8230;]
756 <em>git submodule</em> [--quiet] deinit [-f|--force] (--all|[--] &lt;path&gt;&#8230;)
757 <em>git submodule</em> [--quiet] update [&lt;options&gt;] [--] [&lt;path&gt;&#8230;]
758 <em>git submodule</em> [--quiet] set-branch [&lt;options&gt;] [--] &lt;path&gt;
759 <em>git submodule</em> [--quiet] set-url [--] &lt;path&gt; &lt;newurl&gt;
760 <em>git submodule</em> [--quiet] summary [&lt;options&gt;] [--] [&lt;path&gt;&#8230;]
761 <em>git submodule</em> [--quiet] foreach [--recursive] &lt;command&gt;
762 <em>git submodule</em> [--quiet] sync [--recursive] [--] [&lt;path&gt;&#8230;]
763 <em>git submodule</em> [--quiet] absorbgitdirs [--] [&lt;path&gt;&#8230;]</pre>
764 <div class="attribution">
765 </div></div>
766 </div>
767 </div>
768 <div class="sect1">
769 <h2 id="_description">DESCRIPTION</h2>
770 <div class="sectionbody">
771 <div class="paragraph"><p>Inspects, updates and manages submodules.</p></div>
772 <div class="paragraph"><p>For more information about submodules, see <a href="gitsubmodules.html">gitsubmodules(7)</a>.</p></div>
773 </div>
774 </div>
775 <div class="sect1">
776 <h2 id="_commands">COMMANDS</h2>
777 <div class="sectionbody">
778 <div class="paragraph"><p>With no arguments, shows the status of existing submodules. Several
779 subcommands are available to perform operations on the submodules.</p></div>
780 <div class="dlist"><dl>
781 <dt class="hdlist1">
782 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;]
783 </dt>
784 <dd>
786 Add the given repository as a submodule at the given path
787 to the changeset to be committed next to the current
788 project: the current project is termed the "superproject".
789 </p>
790 <div class="paragraph"><p>&lt;repository&gt; is the URL of the new submodule&#8217;s origin repository.
791 This may be either an absolute URL, or (if it begins with ./
792 or ../), the location relative to the superproject&#8217;s default remote
793 repository (Please note that to specify a repository <em>foo.git</em>
794 which is located right next to a superproject <em>bar.git</em>, you&#8217;ll
795 have to use <code>../foo.git</code> instead of <code>./foo.git</code> - as one might expect
796 when following the rules for relative URLs - because the evaluation
797 of relative URLs in Git is identical to that of relative directories).</p></div>
798 <div class="paragraph"><p>The default remote is the remote of the remote-tracking branch
799 of the current branch. If no such remote-tracking branch exists or
800 the HEAD is detached, "origin" is assumed to be the default remote.
801 If the superproject doesn&#8217;t have a default remote configured
802 the superproject is its own authoritative upstream and the current
803 working directory is used instead.</p></div>
804 <div class="paragraph"><p>The optional argument &lt;path&gt; is the relative location for the cloned
805 submodule to exist in the superproject. If &lt;path&gt; is not given, the
806 canonical part of the source repository is used ("repo" for
807 "/path/to/repo.git" and "foo" for "host.xz:foo/.git"). If &lt;path&gt;
808 exists and is already a valid Git repository, then it is staged
809 for commit without cloning. The &lt;path&gt; is also used as the submodule&#8217;s
810 logical name in its configuration entries unless <code>--name</code> is used
811 to specify a logical name.</p></div>
812 <div class="paragraph"><p>The given URL is recorded into <code>.gitmodules</code> for use by subsequent users
813 cloning the superproject. If the URL is given relative to the
814 superproject&#8217;s repository, the presumption is the superproject and
815 submodule repositories will be kept together in the same relative
816 location, and only the superproject&#8217;s URL needs to be provided.
817 git-submodule will correctly locate the submodule using the relative
818 URL in <code>.gitmodules</code>.</p></div>
819 </dd>
820 <dt class="hdlist1">
821 status [--cached] [--recursive] [--] [&lt;path&gt;&#8230;]
822 </dt>
823 <dd>
825 Show the status of the submodules. This will print the SHA-1 of the
826 currently checked out commit for each submodule, along with the
827 submodule path and the output of <em>git describe</em> for the
828 SHA-1. Each SHA-1 will possibly be prefixed with <code>-</code> if the submodule is
829 not initialized, <code>+</code> if the currently checked out submodule commit
830 does not match the SHA-1 found in the index of the containing
831 repository and <code>U</code> if the submodule has merge conflicts.
832 </p>
833 <div class="paragraph"><p>If <code>--cached</code> is specified, this command will instead print the SHA-1
834 recorded in the superproject for each submodule.</p></div>
835 <div class="paragraph"><p>If <code>--recursive</code> is specified, this command will recurse into nested
836 submodules, and show their status as well.</p></div>
837 <div class="paragraph"><p>If you are only interested in changes of the currently initialized
838 submodules with respect to the commit recorded in the index or the HEAD,
839 <a href="git-status.html">git-status(1)</a> and <a href="git-diff.html">git-diff(1)</a> will provide that information
840 too (and can also report changes to a submodule&#8217;s work tree).</p></div>
841 </dd>
842 <dt class="hdlist1">
843 init [--] [&lt;path&gt;&#8230;]
844 </dt>
845 <dd>
847 Initialize the submodules recorded in the index (which were
848 added and committed elsewhere) by setting <code>submodule.$name.url</code>
849 in <code>.git/config</code>, using the same setting from <code>.gitmodules</code> as
850 a template. If the URL is relative, it will be resolved using
851 the default remote. If there is no default remote, the current
852 repository will be assumed to be upstream.
853 </p>
854 <div class="paragraph"><p>Optional &lt;path&gt; arguments limit which submodules will be initialized.
855 If no path is specified and submodule.active has been configured, submodules
856 configured to be active will be initialized, otherwise all submodules are
857 initialized.</p></div>
858 <div class="paragraph"><p>It will also copy the value of <code>submodule.$name.update</code>, if present in
859 the <code>.gitmodules</code> file, to <code>.git/config</code>, but (1) this command does not
860 alter existing information in <code>.git/config</code>, and (2) <code>submodule.$name.update</code>
861 that is set to a custom command is <strong>not</strong> copied for security reasons.</p></div>
862 <div class="paragraph"><p>You can then customize the submodule clone URLs in <code>.git/config</code>
863 for your local setup and proceed to <code>git submodule update</code>;
864 you can also just use <code>git submodule update --init</code> without
865 the explicit <em>init</em> step if you do not intend to customize
866 any submodule locations.</p></div>
867 <div class="paragraph"><p>See the add subcommand for the definition of default remote.</p></div>
868 </dd>
869 <dt class="hdlist1">
870 deinit [-f|--force] (--all|[--] &lt;path&gt;&#8230;)
871 </dt>
872 <dd>
874 Unregister the given submodules, i.e. remove the whole
875 <code>submodule.$name</code> section from .git/config together with their work
876 tree. Further calls to <code>git submodule update</code>, <code>git submodule foreach</code>
877 and <code>git submodule sync</code> will skip any unregistered submodules until
878 they are initialized again, so use this command if you don&#8217;t want to
879 have a local checkout of the submodule in your working tree anymore.
880 </p>
881 <div class="paragraph"><p>When the command is run without pathspec, it errors out,
882 instead of deinit-ing everything, to prevent mistakes.</p></div>
883 <div class="paragraph"><p>If <code>--force</code> is specified, the submodule&#8217;s working tree will
884 be removed even if it contains local modifications.</p></div>
885 <div class="paragraph"><p>If you really want to remove a submodule from the repository and commit
886 that use <a href="git-rm.html">git-rm(1)</a> instead. See <a href="gitsubmodules.html">gitsubmodules(7)</a> for removal
887 options.</p></div>
888 </dd>
889 <dt class="hdlist1">
890 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;]
891 </dt>
892 <dd>
893 <div class="openblock">
894 <div class="content">
895 <div class="paragraph"><p>Update the registered submodules to match what the superproject
896 expects by cloning missing submodules, fetching missing commits
897 in submodules and updating the working tree of
898 the submodules. The "updating" can be done in several ways depending
899 on command line options and the value of <code>submodule.&lt;name&gt;.update</code>
900 configuration variable. The command line option takes precedence over
901 the configuration variable. If neither is given, a <em>checkout</em> is performed.
902 (note: what is in <code>.gitmodules</code> file is irrelevant at this point;
903 see <code>git submodule init</code> above for how <code>.gitmodules</code> is used).
904 The <em>update</em> procedures supported both from the command line as well as
905 through the <code>submodule.&lt;name&gt;.update</code> configuration are:</p></div>
906 <div class="dlist"><dl>
907 <dt class="hdlist1">
908 checkout
909 </dt>
910 <dd>
912 the commit recorded in the superproject will be
913 checked out in the submodule on a detached HEAD.
914 </p>
915 <div class="paragraph"><p>If <code>--force</code> is specified, the submodule will be checked out (using
916 <code>git checkout --force</code>), even if the commit specified
917 in the index of the containing repository already matches the commit
918 checked out in the submodule.</p></div>
919 </dd>
920 <dt class="hdlist1">
921 rebase
922 </dt>
923 <dd>
925 the current branch of the submodule will be rebased
926 onto the commit recorded in the superproject.
927 </p>
928 </dd>
929 <dt class="hdlist1">
930 merge
931 </dt>
932 <dd>
934 the commit recorded in the superproject will be merged
935 into the current branch in the submodule.
936 </p>
937 </dd>
938 </dl></div>
939 <div class="paragraph"><p>The following update procedures have additional limitations:</p></div>
940 <div class="dlist"><dl>
941 <dt class="hdlist1">
942 custom command
943 </dt>
944 <dd>
946 mechanism for running arbitrary commands with the
947 commit ID as an argument. Specifically, if the
948 <code>submodule.&lt;name&gt;.update</code> configuration variable is set to
949 <code>!custom command</code>, the object name of the commit recorded in the
950 superproject for the submodule is appended to the <code>custom command</code>
951 string and executed. Note that this mechanism is not supported in
952 the <code>.gitmodules</code> file or on the command line.
953 </p>
954 </dd>
955 <dt class="hdlist1">
956 none
957 </dt>
958 <dd>
960 the submodule is not updated. This update procedure is not
961 allowed on the command line.
962 </p>
963 </dd>
964 </dl></div>
965 <div class="paragraph"><p>If the submodule is not yet initialized, and you just want to use the
966 setting as stored in <code>.gitmodules</code>, you can automatically initialize the
967 submodule with the <code>--init</code> option.</p></div>
968 <div class="paragraph"><p>If <code>--recursive</code> is specified, this command will recurse into the
969 registered submodules, and update any nested submodules within.</p></div>
970 <div class="paragraph"><p>If <code>--filter &lt;filter spec&gt;</code> is specified, the given partial clone filter will be
971 applied to the submodule. See <a href="git-rev-list.html">git-rev-list(1)</a> for details on filter
972 specifications.</p></div>
973 </div></div>
974 </dd>
975 <dt class="hdlist1">
976 set-branch (-b|--branch) &lt;branch&gt; [--] &lt;path&gt;
977 </dt>
978 <dt class="hdlist1">
979 set-branch (-d|--default) [--] &lt;path&gt;
980 </dt>
981 <dd>
983 Sets the default remote tracking branch for the submodule. The
984 <code>--branch</code> option allows the remote branch to be specified. The
985 <code>--default</code> option removes the submodule.&lt;name&gt;.branch configuration
986 key, which causes the tracking branch to default to the remote <em>HEAD</em>.
987 </p>
988 </dd>
989 <dt class="hdlist1">
990 set-url [--] &lt;path&gt; &lt;newurl&gt;
991 </dt>
992 <dd>
994 Sets the URL of the specified submodule to &lt;newurl&gt;. Then, it will
995 automatically synchronize the submodule&#8217;s new remote URL
996 configuration.
997 </p>
998 </dd>
999 <dt class="hdlist1">
1000 summary [--cached|--files] [(-n|--summary-limit) &lt;n&gt;] [commit] [--] [&lt;path&gt;&#8230;]
1001 </dt>
1002 <dd>
1004 Show commit summary between the given commit (defaults to HEAD) and
1005 working tree/index. For a submodule in question, a series of commits
1006 in the submodule between the given super project commit and the
1007 index or working tree (switched by <code>--cached</code>) are shown. If the option
1008 <code>--files</code> is given, show the series of commits in the submodule between
1009 the index of the super project and the working tree of the submodule
1010 (this option doesn&#8217;t allow to use the <code>--cached</code> option or to provide an
1011 explicit commit).
1012 </p>
1013 <div class="paragraph"><p>Using the <code>--submodule=log</code> option with <a href="git-diff.html">git-diff(1)</a> will provide that
1014 information too.</p></div>
1015 </dd>
1016 <dt class="hdlist1">
1017 foreach [--recursive] &lt;command&gt;
1018 </dt>
1019 <dd>
1021 Evaluates an arbitrary shell command in each checked out submodule.
1022 The command has access to the variables $name, $sm_path, $displaypath,
1023 $sha1 and $toplevel:
1024 $name is the name of the relevant submodule section in <code>.gitmodules</code>,
1025 $sm_path is the path of the submodule as recorded in the immediate
1026 superproject, $displaypath contains the relative path from the
1027 current working directory to the submodules root directory,
1028 $sha1 is the commit as recorded in the immediate
1029 superproject, and $toplevel is the absolute path to the top-level
1030 of the immediate superproject.
1031 Note that to avoid conflicts with <em>$PATH</em> on Windows, the <em>$path</em>
1032 variable is now a deprecated synonym of <em>$sm_path</em> variable.
1033 Any submodules defined in the superproject but not checked out are
1034 ignored by this command. Unless given <code>--quiet</code>, foreach prints the name
1035 of each submodule before evaluating the command.
1036 If <code>--recursive</code> is given, submodules are traversed recursively (i.e.
1037 the given shell command is evaluated in nested submodules as well).
1038 A non-zero return from the command in any submodule causes
1039 the processing to terminate. This can be overridden by adding <em>|| :</em>
1040 to the end of the command.
1041 </p>
1042 <div class="paragraph"><p>As an example, the command below will show the path and currently
1043 checked out commit for each submodule:</p></div>
1044 <div class="listingblock">
1045 <div class="content">
1046 <pre><code>git submodule foreach 'echo $sm_path `git rev-parse HEAD`'</code></pre>
1047 </div></div>
1048 </dd>
1049 <dt class="hdlist1">
1050 sync [--recursive] [--] [&lt;path&gt;&#8230;]
1051 </dt>
1052 <dd>
1054 Synchronizes submodules' remote URL configuration setting
1055 to the value specified in <code>.gitmodules</code>. It will only affect those
1056 submodules which already have a URL entry in .git/config (that is the
1057 case when they are initialized or freshly added). This is useful when
1058 submodule URLs change upstream and you need to update your local
1059 repositories accordingly.
1060 </p>
1061 <div class="paragraph"><p><code>git submodule sync</code> synchronizes all submodules while
1062 <code>git submodule sync -- A</code> synchronizes submodule "A" only.</p></div>
1063 <div class="paragraph"><p>If <code>--recursive</code> is specified, this command will recurse into the
1064 registered submodules, and sync any nested submodules within.</p></div>
1065 </dd>
1066 <dt class="hdlist1">
1067 absorbgitdirs
1068 </dt>
1069 <dd>
1071 If a git directory of a submodule is inside the submodule,
1072 move the git directory of the submodule into its superproject&#8217;s
1073 <code>$GIT_DIR/modules</code> path and then connect the git directory and
1074 its working directory by setting the <code>core.worktree</code> and adding
1075 a .git file pointing to the git directory embedded in the
1076 superprojects git directory.
1077 </p>
1078 <div class="paragraph"><p>A repository that was cloned independently and later added as a submodule or
1079 old setups have the submodules git directory inside the submodule instead of
1080 embedded into the superprojects git directory.</p></div>
1081 <div class="paragraph"><p>This command is recursive by default.</p></div>
1082 </dd>
1083 </dl></div>
1084 </div>
1085 </div>
1086 <div class="sect1">
1087 <h2 id="_options">OPTIONS</h2>
1088 <div class="sectionbody">
1089 <div class="dlist"><dl>
1090 <dt class="hdlist1">
1092 </dt>
1093 <dt class="hdlist1">
1094 --quiet
1095 </dt>
1096 <dd>
1098 Only print error messages.
1099 </p>
1100 </dd>
1101 <dt class="hdlist1">
1102 --progress
1103 </dt>
1104 <dd>
1106 This option is only valid for add and update commands.
1107 Progress status is reported on the standard error stream
1108 by default when it is attached to a terminal, unless -q
1109 is specified. This flag forces progress status even if the
1110 standard error stream is not directed to a terminal.
1111 </p>
1112 </dd>
1113 <dt class="hdlist1">
1114 --all
1115 </dt>
1116 <dd>
1118 This option is only valid for the deinit command. Unregister all
1119 submodules in the working tree.
1120 </p>
1121 </dd>
1122 <dt class="hdlist1">
1123 -b &lt;branch&gt;
1124 </dt>
1125 <dt class="hdlist1">
1126 --branch &lt;branch&gt;
1127 </dt>
1128 <dd>
1130 Branch of repository to add as submodule.
1131 The name of the branch is recorded as <code>submodule.&lt;name&gt;.branch</code> in
1132 <code>.gitmodules</code> for <code>update --remote</code>. A special value of <code>.</code> is used to
1133 indicate that the name of the branch in the submodule should be the
1134 same name as the current branch in the current repository. If the
1135 option is not specified, it defaults to the remote <em>HEAD</em>.
1136 </p>
1137 </dd>
1138 <dt class="hdlist1">
1140 </dt>
1141 <dt class="hdlist1">
1142 --force
1143 </dt>
1144 <dd>
1146 This option is only valid for add, deinit and update commands.
1147 When running add, allow adding an otherwise ignored submodule path.
1148 When running deinit the submodule working trees will be removed even
1149 if they contain local changes.
1150 When running update (only effective with the checkout procedure),
1151 throw away local changes in submodules when switching to a
1152 different commit; and always run a checkout operation in the
1153 submodule, even if the commit listed in the index of the
1154 containing repository matches the commit checked out in the
1155 submodule.
1156 </p>
1157 </dd>
1158 <dt class="hdlist1">
1159 --cached
1160 </dt>
1161 <dd>
1163 This option is only valid for status and summary commands. These
1164 commands typically use the commit found in the submodule HEAD, but
1165 with this option, the commit stored in the index is used instead.
1166 </p>
1167 </dd>
1168 <dt class="hdlist1">
1169 --files
1170 </dt>
1171 <dd>
1173 This option is only valid for the summary command. This command
1174 compares the commit in the index with that in the submodule HEAD
1175 when this option is used.
1176 </p>
1177 </dd>
1178 <dt class="hdlist1">
1180 </dt>
1181 <dt class="hdlist1">
1182 --summary-limit
1183 </dt>
1184 <dd>
1186 This option is only valid for the summary command.
1187 Limit the summary size (number of commits shown in total).
1188 Giving 0 will disable the summary; a negative number means unlimited
1189 (the default). This limit only applies to modified submodules. The
1190 size is always limited to 1 for added/deleted/typechanged submodules.
1191 </p>
1192 </dd>
1193 <dt class="hdlist1">
1194 --remote
1195 </dt>
1196 <dd>
1198 This option is only valid for the update command. Instead of using
1199 the superproject&#8217;s recorded SHA-1 to update the submodule, use the
1200 status of the submodule&#8217;s remote-tracking branch. The remote used
1201 is branch&#8217;s remote (<code>branch.&lt;name&gt;.remote</code>), defaulting to <code>origin</code>.
1202 The remote branch used defaults to the remote <code>HEAD</code>, but the branch
1203 name may be overridden by setting the <code>submodule.&lt;name&gt;.branch</code>
1204 option in either <code>.gitmodules</code> or <code>.git/config</code> (with <code>.git/config</code>
1205 taking precedence).
1206 </p>
1207 <div class="paragraph"><p>This works for any of the supported update procedures (<code>--checkout</code>,
1208 <code>--rebase</code>, etc.). The only change is the source of the target SHA-1.
1209 For example, <code>submodule update --remote --merge</code> will merge upstream
1210 submodule changes into the submodules, while <code>submodule update
1211 --merge</code> will merge superproject gitlink changes into the submodules.</p></div>
1212 <div class="paragraph"><p>In order to ensure a current tracking branch state, <code>update --remote</code>
1213 fetches the submodule&#8217;s remote repository before calculating the
1214 SHA-1. If you don&#8217;t want to fetch, you should use <code>submodule update
1215 --remote --no-fetch</code>.</p></div>
1216 <div class="paragraph"><p>Use this option to integrate changes from the upstream subproject with
1217 your submodule&#8217;s current HEAD. Alternatively, you can run <code>git pull</code>
1218 from the submodule, which is equivalent except for the remote branch
1219 name: <code>update --remote</code> uses the default upstream repository and
1220 <code>submodule.&lt;name&gt;.branch</code>, while <code>git pull</code> uses the submodule&#8217;s
1221 <code>branch.&lt;name&gt;.merge</code>. Prefer <code>submodule.&lt;name&gt;.branch</code> if you want
1222 to distribute the default upstream branch with the superproject and
1223 <code>branch.&lt;name&gt;.merge</code> if you want a more native feel while working in
1224 the submodule itself.</p></div>
1225 </dd>
1226 <dt class="hdlist1">
1228 </dt>
1229 <dt class="hdlist1">
1230 --no-fetch
1231 </dt>
1232 <dd>
1234 This option is only valid for the update command.
1235 Don&#8217;t fetch new objects from the remote site.
1236 </p>
1237 </dd>
1238 <dt class="hdlist1">
1239 --checkout
1240 </dt>
1241 <dd>
1243 This option is only valid for the update command.
1244 Checkout the commit recorded in the superproject on a detached HEAD
1245 in the submodule. This is the default behavior, the main use of
1246 this option is to override <code>submodule.$name.update</code> when set to
1247 a value other than <code>checkout</code>.
1248 If the key <code>submodule.$name.update</code> is either not explicitly set or
1249 set to <code>checkout</code>, this option is implicit.
1250 </p>
1251 </dd>
1252 <dt class="hdlist1">
1253 --merge
1254 </dt>
1255 <dd>
1257 This option is only valid for the update command.
1258 Merge the commit recorded in the superproject into the current branch
1259 of the submodule. If this option is given, the submodule&#8217;s HEAD will
1260 not be detached. If a merge failure prevents this process, you will
1261 have to resolve the resulting conflicts within the submodule with the
1262 usual conflict resolution tools.
1263 If the key <code>submodule.$name.update</code> is set to <code>merge</code>, this option is
1264 implicit.
1265 </p>
1266 </dd>
1267 <dt class="hdlist1">
1268 --rebase
1269 </dt>
1270 <dd>
1272 This option is only valid for the update command.
1273 Rebase the current branch onto the commit recorded in the
1274 superproject. If this option is given, the submodule&#8217;s HEAD will not
1275 be detached. If a merge failure prevents this process, you will have
1276 to resolve these failures with <a href="git-rebase.html">git-rebase(1)</a>.
1277 If the key <code>submodule.$name.update</code> is set to <code>rebase</code>, this option is
1278 implicit.
1279 </p>
1280 </dd>
1281 <dt class="hdlist1">
1282 --init
1283 </dt>
1284 <dd>
1286 This option is only valid for the update command.
1287 Initialize all submodules for which "git submodule init" has not been
1288 called so far before updating.
1289 </p>
1290 </dd>
1291 <dt class="hdlist1">
1292 --name
1293 </dt>
1294 <dd>
1296 This option is only valid for the add command. It sets the submodule&#8217;s
1297 name to the given string instead of defaulting to its path. The name
1298 must be valid as a directory name and may not end with a <em>/</em>.
1299 </p>
1300 </dd>
1301 <dt class="hdlist1">
1302 --reference &lt;repository&gt;
1303 </dt>
1304 <dd>
1306 This option is only valid for add and update commands. These
1307 commands sometimes need to clone a remote repository. In this case,
1308 this option will be passed to the <a href="git-clone.html">git-clone(1)</a> command.
1309 </p>
1310 <div class="paragraph"><p><strong>NOTE</strong>: Do <strong>not</strong> use this option unless you have read the note
1311 for <a href="git-clone.html">git-clone(1)</a>'s <code>--reference</code>, <code>--shared</code>, and <code>--dissociate</code>
1312 options carefully.</p></div>
1313 </dd>
1314 <dt class="hdlist1">
1315 --dissociate
1316 </dt>
1317 <dd>
1319 This option is only valid for add and update commands. These
1320 commands sometimes need to clone a remote repository. In this case,
1321 this option will be passed to the <a href="git-clone.html">git-clone(1)</a> command.
1322 </p>
1323 <div class="paragraph"><p><strong>NOTE</strong>: see the NOTE for the <code>--reference</code> option.</p></div>
1324 </dd>
1325 <dt class="hdlist1">
1326 --recursive
1327 </dt>
1328 <dd>
1330 This option is only valid for foreach, update, status and sync commands.
1331 Traverse submodules recursively. The operation is performed not
1332 only in the submodules of the current repo, but also
1333 in any nested submodules inside those submodules (and so on).
1334 </p>
1335 </dd>
1336 <dt class="hdlist1">
1337 --depth
1338 </dt>
1339 <dd>
1341 This option is valid for add and update commands. Create a <em>shallow</em>
1342 clone with a history truncated to the specified number of revisions.
1343 See <a href="git-clone.html">git-clone(1)</a>
1344 </p>
1345 </dd>
1346 <dt class="hdlist1">
1347 --[no-]recommend-shallow
1348 </dt>
1349 <dd>
1351 This option is only valid for the update command.
1352 The initial clone of a submodule will use the recommended
1353 <code>submodule.&lt;name&gt;.shallow</code> as provided by the <code>.gitmodules</code> file
1354 by default. To ignore the suggestions use <code>--no-recommend-shallow</code>.
1355 </p>
1356 </dd>
1357 <dt class="hdlist1">
1358 -j &lt;n&gt;
1359 </dt>
1360 <dt class="hdlist1">
1361 --jobs &lt;n&gt;
1362 </dt>
1363 <dd>
1365 This option is only valid for the update command.
1366 Clone new submodules in parallel with as many jobs.
1367 Defaults to the <code>submodule.fetchJobs</code> option.
1368 </p>
1369 </dd>
1370 <dt class="hdlist1">
1371 --[no-]single-branch
1372 </dt>
1373 <dd>
1375 This option is only valid for the update command.
1376 Clone only one branch during update: HEAD or one specified by --branch.
1377 </p>
1378 </dd>
1379 <dt class="hdlist1">
1380 &lt;path&gt;&#8230;
1381 </dt>
1382 <dd>
1384 Paths to submodule(s). When specified this will restrict the command
1385 to only operate on the submodules found at the specified paths.
1386 (This argument is required with add).
1387 </p>
1388 </dd>
1389 </dl></div>
1390 </div>
1391 </div>
1392 <div class="sect1">
1393 <h2 id="_files">FILES</h2>
1394 <div class="sectionbody">
1395 <div class="paragraph"><p>When initializing submodules, a <code>.gitmodules</code> file in the top-level directory
1396 of the containing repository is used to find the url of each submodule.
1397 This file should be formatted in the same way as <code>$GIT_DIR/config</code>. The key
1398 to each submodule url is "submodule.$name.url". See <a href="gitmodules.html">gitmodules(5)</a>
1399 for details.</p></div>
1400 </div>
1401 </div>
1402 <div class="sect1">
1403 <h2 id="_see_also">SEE ALSO</h2>
1404 <div class="sectionbody">
1405 <div class="paragraph"><p><a href="gitsubmodules.html">gitsubmodules(7)</a>, <a href="gitmodules.html">gitmodules(5)</a>.</p></div>
1406 </div>
1407 </div>
1408 <div class="sect1">
1409 <h2 id="_git">GIT</h2>
1410 <div class="sectionbody">
1411 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1412 </div>
1413 </div>
1414 </div>
1415 <div id="footnotes"><hr /></div>
1416 <div id="footer">
1417 <div id="footer-text">
1418 Last updated
1419 2023-08-04 12:03:14 PDT
1420 </div>
1421 </div>
1422 </body>
1423 </html>