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">
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 */
14 font-family: Georgia,serif;
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
22 #author, #revnumber, #revdate, #revremark,
24 font-family: Arial,Helvetica,sans-serif;
28 margin:
1em
5%
1em
5%;
33 text-decoration: underline;
49 h1, h2, h3, h4, h5, h6 {
57 border-bottom:
2px solid silver;
77 border:
1px solid silver;
88 ul
> li { color: #aaa; }
89 ul
> li
> * { color: black; }
91 .monospaced, code, pre {
92 font-family:
"Courier New", Courier, monospace;
99 white-space: pre-wrap;
109 #revnumber, #revdate, #revremark {
114 border-top:
2px solid silver;
120 padding-bottom:
0.5em;
124 padding-bottom:
0.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 {
135 margin-bottom:
1.5em;
137 div.admonitionblock {
139 margin-bottom:
2.0em;
144 div.content { /* Block element content. */
148 /* Block element titles. */
149 div.title, caption.title {
154 margin-bottom:
0.5em;
160 td div.title:first-child {
163 div.content div.title:first-child {
166 div.content + div.title {
170 div.sidebarblock
> div.content {
172 border:
1px solid #dddddd;
173 border-left:
4px solid #f0f0f0;
177 div.listingblock
> div.content {
178 border:
1px solid #dddddd;
179 border-left:
5px solid #f0f0f0;
184 div.quoteblock, div.verseblock {
188 border-left:
5px solid #f0f0f0;
192 div.quoteblock
> div.attribution {
197 div.verseblock
> pre.content {
198 font-family: inherit;
201 div.verseblock
> div.attribution {
205 /* DEPRECATED: Pre version
8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
210 div.admonitionblock .icon {
214 text-decoration: underline;
216 padding-right:
0.5em;
218 div.admonitionblock td.content {
220 border-left:
3px solid #dddddd;
223 div.exampleblock
> div.content {
224 border-left:
3px solid #dddddd;
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; }
234 margin-bottom:
0.8em;
247 list-style-position: outside;
250 list-style-type: decimal;
253 list-style-type: lower-alpha;
256 list-style-type: upper-alpha;
259 list-style-type: lower-roman;
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 {
269 margin-bottom:
0.1em;
281 margin-bottom:
0.8em;
284 padding-bottom:
15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
292 padding-right:
0.8em;
298 div.hdlist.compact tr {
307 .footnote, .footnoteref {
311 span.footnote, span.footnoteref {
312 vertical-align: super;
316 margin:
20px
0 20px
0;
320 #footnotes div.footnote {
326 border-top:
1px solid silver;
335 padding-right:
0.5em;
336 padding-bottom:
0.3em;
344 #footer-badges { display: none; }
348 margin-bottom:
2.5em;
356 margin-bottom:
0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
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; }
427 margin-bottom:
1.5em;
429 div.tableblock
> table {
430 border:
3px solid #
527bbd;
432 thead, p.table.header {
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock
> table[
frame=
"void"] {
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;
460 margin-bottom:
1.5em;
462 thead, p.tableblock.header {
473 border-color: #
527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
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 {
498 th.tableblock.halign-center, td.tableblock.halign-center {
501 th.tableblock.halign-right, td.tableblock.halign-right {
505 th.tableblock.valign-top, td.tableblock.valign-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;
523 padding-bottom:
0.5em;
524 border-top:
2px solid silver;
525 border-bottom:
2px solid silver;
530 body.manpage div.sectionbody {
535 body.manpage div#toc { display: none; }
540 <script type=
"text/javascript">
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
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 */
562 toc: function (toclevels) {
564 function getText(el) {
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType ==
3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 else if (i.firstChild != null)
575 function TocEntry(el, text, toclevel) {
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
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);
602 var toc = document.getElementById(
"toc");
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
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");
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.
651 var noteholder = document.getElementById(
"footnotes");
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");
670 for (i=
0; i
<spans.length; i++) {
671 if (spans[i].className ==
"footnote") {
673 var note = spans[i].getAttribute(
"data-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];
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;
692 noteholder.parentNode.removeChild(noteholder);
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.
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n +
"</a>]";
708 install: function(toclevels) {
711 function reinstall() {
712 asciidoc.footnotes();
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
723 timerId = setInterval(reinstall,
500);
724 if (document.addEventListener)
725 document.addEventListener(
"DOMContentLoaded", reinstallAndRemoveTimer, false);
727 window.onload = reinstallAndRemoveTimer;
735 <body class=
"manpage">
738 git-submodule(
1) Manual Page
741 <div class=
"sectionbody">
743 Initialize, update or inspect submodules
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 [
<options
>] [--]
<repository
> [
<path
>]
754 <em>git submodule
</em> [--quiet] status [--cached] [--recursive] [--] [
<path
>…]
755 <em>git submodule
</em> [--quiet] init [--] [
<path
>…]
756 <em>git submodule
</em> [--quiet] deinit [-f|--force] (--all|[--]
<path
>…)
757 <em>git submodule
</em> [--quiet] update [
<options
>] [--] [
<path
>…]
758 <em>git submodule
</em> [--quiet] set-branch [
<options
>] [--]
<path
>
759 <em>git submodule
</em> [--quiet] set-url [--]
<path
> <newurl
>
760 <em>git submodule
</em> [--quiet] summary [
<options
>] [--] [
<path
>…]
761 <em>git submodule
</em> [--quiet] foreach [--recursive]
<command
>
762 <em>git submodule
</em> [--quiet] sync [--recursive] [--] [
<path
>…]
763 <em>git submodule
</em> [--quiet] absorbgitdirs [--] [
<path
>…]
</pre>
764 <div class=
"attribution">
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>
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>
782 add [-b
<branch
>] [-f|--force] [--name
<name
>] [--reference
<repository
>] [--depth
<depth
>] [--]
<repository
> [
<path
>]
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".
790 <div class=
"paragraph"><p><repository
> is the URL of the new submodule
’s origin repository.
791 This may be either an absolute URL, or (if it begins with ./
792 or ../), the location relative to the superproject
’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
’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
’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
<path
> is the relative location for the cloned
805 submodule to exist in the superproject. If
<path
> 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
<path
>
808 exists and is already a valid Git repository, then it is staged
809 for commit without cloning. The
<path
> is also used as the submodule
’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
’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
’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>
821 status [--cached] [--recursive] [--] [
<path
>…]
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.
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
’s work tree).
</p></div>
843 init [--] [
<path
>…]
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.
854 <div class=
"paragraph"><p>Optional
<path
> 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>
870 deinit [-f|--force] (--all|[--]
<path
>…)
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
’t want to
879 have a local checkout of the submodule in your working tree anymore.
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
’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
890 update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference
<repository
>] [--depth
<depth
>] [--recursive] [--jobs
<n
>] [--[no-]single-branch] [--filter
<filter-spec
>] [--] [
<path
>…]
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.
<name
>.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.
<name
>.update
</code> configuration are:
</p></div>
906 <div class=
"dlist"><dl>
912 the commit recorded in the superproject will be
913 checked out in the submodule on a detached HEAD.
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>
925 the current branch of the submodule will be rebased
926 onto the commit recorded in the superproject.
934 the commit recorded in the superproject will be merged
935 into the current branch in the submodule.
939 <div class=
"paragraph"><p>The following update procedures have additional limitations:
</p></div>
940 <div class=
"dlist"><dl>
946 mechanism for running arbitrary commands with the
947 commit ID as an argument. Specifically, if the
948 <code>submodule.
<name
>.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.
960 the submodule is not updated. This update procedure is not
961 allowed on the command line.
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
<filter-spec
></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>
976 set-branch (-b|--branch)
<branch
> [--]
<path
>
979 set-branch (-d|--default) [--]
<path
>
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.
<name
>.branch configuration
986 key, which causes the tracking branch to default to the remote
<em>HEAD
</em>.
990 set-url [--]
<path
> <newurl
>
994 Sets the URL of the specified submodule to
<newurl
>. Then, it will
995 automatically synchronize the submodule
’s new remote URL
1000 summary [--cached|--files] [(-n|--summary-limit)
<n
>] [commit] [--] [
<path
>…]
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
’t allow to use the
<code>--cached
</code> option or to provide an
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>
1016 <dt class=
"hdlist1">
1017 foreach [--recursive]
<command
>
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.
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>
1049 <dt class=
"hdlist1">
1050 sync [--recursive] [--] [
<path
>…]
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.
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>
1066 <dt class=
"hdlist1">
1071 If a git directory of a submodule is inside the submodule,
1072 move the git directory of the submodule into its superproject
’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.
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>
1087 <h2 id=
"_options">OPTIONS
</h2>
1088 <div class=
"sectionbody">
1089 <div class=
"dlist"><dl>
1090 <dt class=
"hdlist1">
1093 <dt class=
"hdlist1">
1098 Only print error messages.
1101 <dt class=
"hdlist1">
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.
1113 <dt class=
"hdlist1">
1118 This option is only valid for the deinit command. Unregister all
1119 submodules in the working tree.
1122 <dt class=
"hdlist1">
1125 <dt class=
"hdlist1">
1126 --branch
<branch
>
1130 Branch of repository to add as submodule.
1131 The name of the branch is recorded as
<code>submodule.
<name
>.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>.
1138 <dt class=
"hdlist1">
1141 <dt class=
"hdlist1">
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
1158 <dt class=
"hdlist1">
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.
1168 <dt class=
"hdlist1">
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.
1178 <dt class=
"hdlist1">
1181 <dt class=
"hdlist1">
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.
1193 <dt class=
"hdlist1">
1198 This option is only valid for the update command. Instead of using
1199 the superproject
’s recorded SHA-
1 to update the submodule, use the
1200 status of the submodule
’s remote-tracking branch. The remote used
1201 is branch
’s remote (
<code>branch.
<name
>.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.
<name
>.branch
</code>
1204 option in either
<code>.gitmodules
</code> or
<code>.git/config
</code> (with
<code>.git/config
</code>
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
’s remote repository before calculating the
1214 SHA-
1. If you don
’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
’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.
<name
>.branch
</code>, while
<code>git pull
</code> uses the submodule
’s
1221 <code>branch.
<name
>.merge
</code>. Prefer
<code>submodule.
<name
>.branch
</code> if you want
1222 to distribute the default upstream branch with the superproject and
1223 <code>branch.
<name
>.merge
</code> if you want a more native feel while working in
1224 the submodule itself.
</p></div>
1226 <dt class=
"hdlist1">
1229 <dt class=
"hdlist1">
1234 This option is only valid for the update command.
1235 Don
’t fetch new objects from the remote site.
1238 <dt class=
"hdlist1">
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.
1252 <dt class=
"hdlist1">
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
’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
1267 <dt class=
"hdlist1">
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
’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
1281 <dt class=
"hdlist1">
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.
1291 <dt class=
"hdlist1">
1296 This option is only valid for the add command. It sets the submodule
’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>.
1301 <dt class=
"hdlist1">
1302 --reference
<repository
>
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.
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>
1314 <dt class=
"hdlist1">
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.
1323 <div class=
"paragraph"><p><strong>NOTE
</strong>: see the NOTE for the
<code>--reference
</code> option.
</p></div>
1325 <dt class=
"hdlist1">
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).
1336 <dt class=
"hdlist1">
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>
1346 <dt class=
"hdlist1">
1347 --[no-]recommend-shallow
1351 This option is only valid for the update command.
1352 The initial clone of a submodule will use the recommended
1353 <code>submodule.
<name
>.shallow
</code> as provided by the
<code>.gitmodules
</code> file
1354 by default. To ignore the suggestions use
<code>--no-recommend-shallow
</code>.
1357 <dt class=
"hdlist1">
1360 <dt class=
"hdlist1">
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.
1370 <dt class=
"hdlist1">
1371 --[no-]single-branch
1375 This option is only valid for the update command.
1376 Clone only one branch during update: HEAD or one specified by --branch.
1379 <dt class=
"hdlist1">
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).
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>
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>
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>
1415 <div id=
"footnotes"><hr /></div>
1417 <div id=
"footer-text">
1419 2024-
02-
08 15:
45:
59 PST