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">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.5.2" />
7 <title>git-submodule(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.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
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.0em;
131 div
.content
{ /* Block element content. */
135 /* Block element titles. */
136 div
.title
, caption
.title
{
138 font-family: sans-serif
;
142 margin-bottom: 0.5em;
148 td div
.title:first-child
{
151 div
.content div
.title:first-child
{
154 div
.content
+ div
.title
{
158 div
.sidebarblock
> div
.content
{
160 border: 1px solid silver
;
164 div
.listingblock
> div
.content
{
165 border: 1px solid silver
;
170 div
.quoteblock
, div
.verseblock
{
174 border-left: 5px solid
#dddddd;
178 div
.quoteblock
> div
.attribution
{
183 div
.verseblock
> div
.content
{
186 div
.verseblock
> div
.attribution
{
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div
.verseblock
+ div
.attribution
{
195 div
.admonitionblock
.icon
{
199 text-decoration: underline
;
201 padding-right: 0.5em;
203 div
.admonitionblock td
.content
{
205 border-left: 3px solid
#dddddd;
208 div
.exampleblock
> div
.content
{
209 border-left: 3px solid
#dddddd;
213 div
.imageblock div
.content
{ padding-left: 0; }
214 span
.image img
{ border-style: none
; }
215 a
.image:visited
{ color: white
; }
219 margin-bottom: 0.8em;
232 list-style-position: outside
;
235 list-style-type: decimal
;
238 list-style-type: lower-alpha
;
241 list-style-type: upper-alpha
;
244 list-style-type: lower-roman
;
247 list-style-type: upper-roman
;
250 div
.compact ul
, div
.compact ol
,
251 div
.compact p
, div
.compact p
,
252 div
.compact div
, div
.compact div
{
254 margin-bottom: 0.1em;
257 div
.tableblock
> table
{
258 border: 3px solid
#527bbd;
260 thead
, p
.table
.header
{
261 font-family: sans-serif
;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div
.tableblock
> table
[frame
="void"] {
277 div
.tableblock
> table
[frame
="hsides"] {
278 border-left-style: none
;
279 border-right-style: none
;
281 div
.tableblock
> table
[frame
="vsides"] {
282 border-top-style: none
;
283 border-bottom-style: none
;
289 margin-bottom: 0.8em;
292 padding-bottom: 15px;
294 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
300 padding-right: 0.8em;
306 div
.hdlist
.compact tr
{
315 .footnote, .footnoteref {
319 span
.footnote
, span
.footnoteref
{
320 vertical-align: super
;
324 margin: 20px 0 20px 0;
328 #footnotes div
.footnote
{
334 border-top: 1px solid silver
;
344 div#footer-badges
{ display: none
; }
348 margin-bottom: 2.5em;
353 font-family: sans-serif
;
357 margin-bottom: 0.1em;
360 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
376 /* Overrides for manpage documents */
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver
;
381 border-bottom: 2px solid silver
;
391 div#toc
{ display: none
; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div
.sidebar-content
{
398 border: 1px solid silver
;
401 div
.sidebar-title
, div
.image-title
{
403 font-family: sans-serif
;
406 margin-bottom: 0.5em;
409 div
.listingblock div
.content
{
410 border: 1px solid silver
;
415 div
.quoteblock-attribution
{
420 div
.verseblock-content
{
423 div
.verseblock-attribution
{
428 div
.exampleblock-content
{
429 border-left: 3px solid
#dddddd;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc
a:visited
{ color: blue
; }
436 <script type=
"text/javascript">
438 window
.onload = function(){asciidoc
.footnotes();}
439 var asciidoc
= { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
459 toc: function (toclevels
) {
461 function getText(el
) {
463 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
464 if (i
.nodeType
== 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
466 else if (i
.firstChild
!= null)
472 function TocEntry(el
, text
, toclevel
) {
475 this.toclevel
= toclevel
;
478 function tocEntries(el
, toclevels
) {
479 var result
= new Array
;
480 var re
= new RegExp('[hH]([2-'+(toclevels
+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
484 var iterate = function (el
) {
485 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
486 if (i
.nodeType
== 1 /* Node.ELEMENT_NODE */) {
487 var mo
= re
.exec(i
.tagName
);
488 if (mo
&& (i
.getAttribute("class") || i
.getAttribute("className")) != "float") {
489 result
[result
.length
] = new TocEntry(i
, getText(i
), mo
[1]-1);
499 var toc
= document
.getElementById("toc");
500 var entries
= tocEntries(document
.getElementById("content"), toclevels
);
501 for (var i
= 0; i
< entries
.length
; ++i
) {
502 var entry
= entries
[i
];
503 if (entry
.element
.id
== "")
504 entry
.element
.id
= "_toc_" + i
;
505 var a
= document
.createElement("a");
506 a
.href
= "#" + entry
.element
.id
;
507 a
.appendChild(document
.createTextNode(entry
.text
));
508 var div
= document
.createElement("div");
510 div
.className
= "toclevel" + entry
.toclevel
;
511 toc
.appendChild(div
);
513 if (entries
.length
== 0)
514 toc
.parentNode
.removeChild(toc
);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont
= document
.getElementById("content");
528 var noteholder
= document
.getElementById("footnotes");
529 var spans
= cont
.getElementsByTagName("span");
532 for (i
=0; i
<spans
.length
; i
++) {
533 if (spans
[i
].className
== "footnote") {
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note
= spans
[i
].innerHTML
.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder
.innerHTML
+=
539 "<div class='footnote' id='_footnote_" + n
+ "'>" +
540 "<a href='#_footnoteref_" + n
+ "' title='Return to text'>" +
541 n
+ "</a>. " + note
+ "</div>";
543 "[<a id='_footnoteref_" + n
+ "' href='#_footnote_" + n
+
544 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
545 var id
=spans
[i
].getAttribute("id");
546 if (id
!= null) refs
["#"+id
] = n
;
550 noteholder
.parentNode
.removeChild(noteholder
);
552 // Process footnoterefs.
553 for (i
=0; i
<spans
.length
; i
++) {
554 if (spans
[i
].className
== "footnoteref") {
555 var href
= spans
[i
].getElementsByTagName("a")[0].getAttribute("href");
556 href
= href
.match(/#.*/)[0]; // Because IE return full URL.
559 "[<a href='#_footnote_" + n
+
560 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
573 git-submodule(
1) Manual Page
576 <div class=
"sectionbody">
578 Initialize, update or inspect submodules
583 <h2 id=
"_synopsis">SYNOPSIS
</h2>
584 <div class=
"sectionbody">
585 <div class=
"verseblock">
586 <div class=
"verseblock-content"><em>git submodule
</em> [--quiet] add [-b branch] [-f|--force]
587 [--reference
<repository
>] [--]
<repository
> [
<path
>]
588 <em>git submodule
</em> [--quiet] status [--cached] [--recursive] [--] [
<path
>…]
589 <em>git submodule
</em> [--quiet] init [--] [
<path
>…]
590 <em>git submodule
</em> [--quiet] update [--init] [-N|--no-fetch] [--rebase]
591 [--reference
<repository
>] [--merge] [--recursive] [--] [
<path
>…]
592 <em>git submodule
</em> [--quiet] summary [--cached|--files] [(-n|--summary-limit)
<n
>]
593 [commit] [--] [
<path
>…]
594 <em>git submodule
</em> [--quiet] foreach [--recursive]
<command
>
595 <em>git submodule
</em> [--quiet] sync [--] [
<path
>…]
</div>
596 <div class=
"verseblock-attribution">
599 <h2 id=
"_description">DESCRIPTION
</h2>
600 <div class=
"sectionbody">
601 <div class=
"paragraph"><p>Submodules allow foreign repositories to be embedded within
602 a dedicated subdirectory of the source tree, always pointed
603 at a particular commit.
</p></div>
604 <div class=
"paragraph"><p>They are not to be confused with remotes, which are meant mainly
605 for branches of the same project; submodules are meant for
606 different projects you would like to make part of your source tree,
607 while the history of the two projects still stays completely
608 independent and you cannot modify the contents of the submodule
609 from within the main project.
610 If you want to merge the project histories and want to treat the
611 aggregated whole as a single project from then on, you may want to
612 add a remote for the other project and use the
<em>subtree
</em> merge strategy,
613 instead of treating the other project as a submodule. Directories
614 that come from both projects can be cloned and checked out as a whole
615 if you choose to go that route.
</p></div>
616 <div class=
"paragraph"><p>Submodules are composed from a so-called
<tt>gitlink
</tt> tree entry
617 in the main repository that refers to a particular commit object
618 within the inner repository that is completely separate.
619 A record in the
<tt>.gitmodules
</tt> file at the root of the source
620 tree assigns a logical name to the submodule and describes
621 the default URL the submodule shall be cloned from.
622 The logical name can be used for overriding this URL within your
623 local repository configuration (see
<em>submodule init
</em>).
</p></div>
624 <div class=
"paragraph"><p>This command will manage the tree entries and contents of the
625 gitmodules file for you, as well as inspect the status of your
626 submodules and update them.
627 When adding a new submodule to the tree, the
<em>add
</em> subcommand
628 is to be used. However, when pulling a tree containing submodules,
629 these will not be checked out by default;
630 the
<em>init
</em> and
<em>update
</em> subcommands will maintain submodules
631 checked out and at appropriate revision in your working tree.
632 You can briefly inspect the up-to-date status of your submodules
633 using the
<em>status
</em> subcommand and get a detailed overview of the
634 difference between the index and checkouts using the
<em>summary
</em>
635 subcommand.
</p></div>
637 <h2 id=
"_commands">COMMANDS
</h2>
638 <div class=
"sectionbody">
639 <div class=
"dlist"><dl>
645 Add the given repository as a submodule at the given path
646 to the changeset to be committed next to the current
647 project: the current project is termed the
"superproject".
649 <div class=
"paragraph"><p>This requires at least one argument:
<repository
>. The optional
650 argument
<path
> is the relative location for the cloned submodule
651 to exist in the superproject. If
<path
> is not given, the
652 "humanish" part of the source repository is used (
"repo" for
653 "/path/to/repo.git" and
"foo" for
"host.xz:foo/.git").
</p></div>
654 <div class=
"paragraph"><p><repository
> is the URL of the new submodule
’s origin repository.
655 This may be either an absolute URL, or (if it begins with ./
656 or ../), the location relative to the superproject
’s origin
657 repository. If the superproject doesn
’t have an origin configured
658 the superproject is its own authoritative upstream and the current
659 working directory is used instead.
</p></div>
660 <div class=
"paragraph"><p><path
> is the relative location for the cloned submodule to
661 exist in the superproject. If
<path
> does not exist, then the
662 submodule is created by cloning from the named URL. If
<path
> does
663 exist and is already a valid git repository, then this is added
664 to the changeset without cloning. This second form is provided
665 to ease creating a new submodule from scratch, and presumes
666 the user will later push the submodule to the given URL.
</p></div>
667 <div class=
"paragraph"><p>In either case, the given URL is recorded into .gitmodules for
668 use by subsequent users cloning the superproject. If the URL is
669 given relative to the superproject
’s repository, the presumption
670 is the superproject and submodule repositories will be kept
671 together in the same relative location, and only the
672 superproject
’s URL needs to be provided: git-submodule will correctly
673 locate the submodule using the relative URL in .gitmodules.
</p></div>
680 Show the status of the submodules. This will print the SHA-
1 of the
681 currently checked out commit for each submodule, along with the
682 submodule path and the output of
<em>git describe
</em> for the
683 SHA-
1. Each SHA-
1 will be prefixed with
<tt>-
</tt> if the submodule is not
684 initialized,
<tt>+
</tt> if the currently checked out submodule commit
685 does not match the SHA-
1 found in the index of the containing
686 repository and
<tt>U
</tt> if the submodule has merge conflicts.
687 This command is the default command for
<em>git submodule
</em>.
689 <div class=
"paragraph"><p>If
<tt>--recursive
</tt> is specified, this command will recurse into nested
690 submodules, and show their status as well.
</p></div>
691 <div class=
"paragraph"><p>If you are only interested in changes of the currently initialized
692 submodules with respect to the commit recorded in the index or the HEAD,
693 <a href=
"git-status.html">git-status(
1)
</a> and
<a href=
"git-diff.html">git-diff(
1)
</a> will provide that information
694 too (and can also report changes to a submodule
’s work tree).
</p></div>
701 Initialize the submodules, i.e. register each submodule name
702 and url found in .gitmodules into .git/config.
703 It will also copy the value of
<tt>submodule.$name.update
</tt> into
705 The key used in .git/config is
<tt>submodule.$name.url
</tt>.
706 This command does not alter existing information in .git/config.
707 You can then customize the submodule clone URLs in .git/config
708 for your local setup and proceed to
<tt>git submodule update
</tt>;
709 you can also just use
<tt>git submodule update --init
</tt> without
710 the explicit
<em>init
</em> step if you do not intend to customize
711 any submodule locations.
719 Update the registered submodules, i.e. clone missing submodules and
720 checkout the commit specified in the index of the containing repository.
721 This will make the submodules HEAD be detached unless
<tt>--rebase
</tt> or
722 <tt>--merge
</tt> is specified or the key
<tt>submodule.$name.update
</tt> is set to
723 <tt>rebase
</tt>,
<tt>merge
</tt> or
<tt>none
</tt>.
725 <div class=
"paragraph"><p>If the submodule is not yet initialized, and you just want to use the
726 setting as stored in .gitmodules, you can automatically initialize the
727 submodule with the
<tt>--init
</tt> option.
</p></div>
728 <div class=
"paragraph"><p>If
<tt>--recursive
</tt> is specified, this command will recurse into the
729 registered submodules, and update any nested submodules within.
</p></div>
730 <div class=
"paragraph"><p>If the configuration key
<tt>submodule.$name.update
</tt> is set to
<tt>none
</tt> the
731 submodule with name
<tt>$name
</tt> will not be updated by default. This can be
732 overriden by adding
<tt>--checkout
</tt> to the command.
</p></div>
739 Show commit summary between the given commit (defaults to HEAD) and
740 working tree/index. For a submodule in question, a series of commits
741 in the submodule between the given super project commit and the
742 index or working tree (switched by
<tt>--cached
</tt>) are shown. If the option
743 <tt>--files
</tt> is given, show the series of commits in the submodule between
744 the index of the super project and the working tree of the submodule
745 (this option doesn
’t allow to use the
<tt>--cached
</tt> option or to provide an
748 <div class=
"paragraph"><p>Using the
<tt>--submodule=log
</tt> option with
<a href=
"git-diff.html">git-diff(
1)
</a> will provide that
749 information too.
</p></div>
756 Evaluates an arbitrary shell command in each checked out submodule.
757 The command has access to the variables $name, $path, $sha1 and
759 $name is the name of the relevant submodule section in .gitmodules,
760 $path is the name of the submodule directory relative to the
761 superproject, $sha1 is the commit as recorded in the superproject,
762 and $toplevel is the absolute path to the top-level of the superproject.
763 Any submodules defined in the superproject but not checked out are
764 ignored by this command. Unless given
<tt>--quiet
</tt>, foreach prints the name
765 of each submodule before evaluating the command.
766 If
<tt>--recursive
</tt> is given, submodules are traversed recursively (i.e.
767 the given shell command is evaluated in nested submodules as well).
768 A non-zero return from the command in any submodule causes
769 the processing to terminate. This can be overridden by adding
<em>|| :
</em>
770 to the end of the command.
772 <div class=
"paragraph"><p>As an example,
<tt>git submodule foreach 'echo $path
`git
773 rev-parse HEAD
`'
</tt> will show the path and currently checked out
774 commit for each submodule.
</p></div>
781 Synchronizes submodules' remote URL configuration setting
782 to the value specified in .gitmodules. It will only affect those
783 submodules which already have an url entry in .git/config (that is the
784 case when they are initialized or freshly added). This is useful when
785 submodule URLs change upstream and you need to update your local
786 repositories accordingly.
788 <div class=
"paragraph"><p>"git submodule sync" synchronizes all submodules while
789 "git submodule sync -- A" synchronizes submodule
"A" only.
</p></div>
793 <h2 id=
"_options">OPTIONS
</h2>
794 <div class=
"sectionbody">
795 <div class=
"dlist"><dl>
804 Only print error messages.
815 Branch of repository to add as submodule.
826 This option is only valid for add and update commands.
827 When running add, allow adding an otherwise ignored submodule path.
828 When running update, throw away local changes in submodules when
829 switching to a different commit.
837 This option is only valid for status and summary commands. These
838 commands typically use the commit found in the submodule HEAD, but
839 with this option, the commit stored in the index is used instead.
847 This option is only valid for the summary command. This command
848 compares the commit in the index with that in the submodule HEAD
849 when this option is used.
860 This option is only valid for the summary command.
861 Limit the summary size (number of commits shown in total).
862 Giving
0 will disable the summary; a negative number means unlimited
863 (the default). This limit only applies to modified submodules. The
864 size is always limited to
1 for added/deleted/typechanged submodules.
875 This option is only valid for the update command.
876 Don
’t fetch new objects from the remote site.
884 This option is only valid for the update command.
885 Merge the commit recorded in the superproject into the current branch
886 of the submodule. If this option is given, the submodule
’s HEAD will
887 not be detached. If a merge failure prevents this process, you will
888 have to resolve the resulting conflicts within the submodule with the
889 usual conflict resolution tools.
890 If the key
<tt>submodule.$name.update
</tt> is set to
<tt>merge
</tt>, this option is
899 This option is only valid for the update command.
900 Rebase the current branch onto the commit recorded in the
901 superproject. If this option is given, the submodule
’s HEAD will not
902 be detached. If a merge failure prevents this process, you will have
903 to resolve these failures with
<a href=
"git-rebase.html">git-rebase(
1)
</a>.
904 If the key
<tt>submodule.$name.update
</tt> is set to
<tt>rebase
</tt>, this option is
913 This option is only valid for the update command.
914 Initialize all submodules for which
"git submodule init" has not been
915 called so far before updating.
919 --reference
<repository
>
923 This option is only valid for add and update commands. These
924 commands sometimes need to clone a remote repository. In this case,
925 this option will be passed to the
<a href=
"git-clone.html">git-clone(
1)
</a> command.
927 <div class=
"paragraph"><p><strong>NOTE
</strong>: Do
<strong>not
</strong> use this option unless you have read the note
928 for
<a href=
"git-clone.html">git-clone(
1)
</a>'s
<tt>--reference
</tt> and
<tt>--shared
</tt> options carefully.
</p></div>
935 This option is only valid for foreach, update and status commands.
936 Traverse submodules recursively. The operation is performed not
937 only in the submodules of the current repo, but also
938 in any nested submodules inside those submodules (and so on).
946 Paths to submodule(s). When specified this will restrict the command
947 to only operate on the submodules found at the specified paths.
948 (This argument is required with add).
953 <h2 id=
"_files">FILES
</h2>
954 <div class=
"sectionbody">
955 <div class=
"paragraph"><p>When initializing submodules, a .gitmodules file in the top-level directory
956 of the containing repository is used to find the url of each submodule.
957 This file should be formatted in the same way as
<tt>$GIT_DIR/config
</tt>. The key
958 to each submodule url is
"submodule.$name.url". See
<a href=
"gitmodules.html">gitmodules(
5)
</a>
959 for details.
</p></div>
961 <h2 id=
"_git">GIT
</h2>
962 <div class=
"sectionbody">
963 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
966 <div id=
"footnotes"><hr /></div>
968 <div id=
"footer-text">
969 Last updated
2011-
10-
10 16:
42:
04 PDT