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.4.5" />
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.5em;
129 div
.content
{ /* Block element content. */
133 /* Block element titles. */
134 div
.title
, caption
.title
{
136 font-family: sans-serif
;
140 margin-bottom: 0.5em;
146 td div
.title:first-child
{
149 div
.content div
.title:first-child
{
152 div
.content
+ div
.title
{
156 div
.sidebarblock
> div
.content
{
158 border: 1px solid silver
;
162 div
.listingblock
> div
.content
{
163 border: 1px solid silver
;
172 div
.quoteblock
> div
.attribution
{
181 div
.verseblock
> div
.content
{
184 div
.verseblock
> div
.attribution
{
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div
.verseblock
+ div
.attribution
{
193 div
.admonitionblock
.icon
{
197 text-decoration: underline
;
199 padding-right: 0.5em;
201 div
.admonitionblock td
.content
{
203 border-left: 2px solid silver
;
206 div
.exampleblock
> div
.content
{
207 border-left: 2px solid silver
;
211 div
.imageblock div
.content
{ padding-left: 0; }
212 span
.image img
{ border-style: none
; }
213 a
.image:visited
{ color: white
; }
217 margin-bottom: 0.8em;
230 list-style-position: outside
;
233 list-style-type: decimal
;
236 list-style-type: lower-alpha
;
239 list-style-type: upper-alpha
;
242 list-style-type: lower-roman
;
245 list-style-type: upper-roman
;
248 div
.compact ul
, div
.compact ol
,
249 div
.compact p
, div
.compact p
,
250 div
.compact div
, div
.compact div
{
252 margin-bottom: 0.1em;
255 div
.tableblock
> table
{
256 border: 3px solid
#527bbd;
259 font-family: sans-serif
;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div
.tableblock
> table
[frame
="void"] {
275 div
.tableblock
> table
[frame
="hsides"] {
276 border-left-style: none
;
277 border-right-style: none
;
279 div
.tableblock
> table
[frame
="vsides"] {
280 border-top-style: none
;
281 border-bottom-style: none
;
287 margin-bottom: 0.8em;
290 padding-bottom: 15px;
292 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
298 padding-right: 0.8em;
304 div
.hdlist
.compact tr
{
314 div#footer-badges
{ display: none
; }
319 font-family: sans-serif
;
323 margin-bottom: 0.1em;
326 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
342 /* Overrides for manpage documents */
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver
;
347 border-bottom: 2px solid silver
;
357 div#toc
{ display: none
; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div
.sidebar-content
{
364 border: 1px solid silver
;
367 div
.sidebar-title
, div
.image-title
{
369 font-family: sans-serif
;
372 margin-bottom: 0.5em;
375 div
.listingblock div
.content
{
376 border: 1px solid silver
;
381 div
.quoteblock-attribution
{
386 div
.verseblock-content
{
389 div
.verseblock-attribution
{
394 div
.exampleblock-content
{
395 border-left: 2px solid silver
;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc
a:visited
{ color: blue
; }
406 git-submodule(
1) Manual Page
409 <div class=
"sectionbody">
411 Initialize, update or inspect submodules
415 <h2 id=
"_synopsis">SYNOPSIS
</h2>
416 <div class=
"sectionbody">
417 <div class=
"verseblock">
418 <div class=
"verseblock-content"><em>git submodule
</em> [--quiet] add [-b branch] [-f|--force]
419 [--reference
<repository
>] [--]
<repository
> [
<path
>]
420 <em>git submodule
</em> [--quiet] status [--cached] [--recursive] [--] [
<path
>…]
421 <em>git submodule
</em> [--quiet] init [--] [
<path
>…]
422 <em>git submodule
</em> [--quiet] update [--init] [-N|--no-fetch] [--rebase]
423 [--reference
<repository
>] [--merge] [--recursive] [--] [
<path
>…]
424 <em>git submodule
</em> [--quiet] summary [--cached|--files] [--summary-limit
<n
>] [commit] [--] [
<path
>…]
425 <em>git submodule
</em> [--quiet] foreach [--recursive]
<command
>
426 <em>git submodule
</em> [--quiet] sync [--] [
<path
>…]
</div>
427 <div class=
"verseblock-attribution">
430 <h2 id=
"_description">DESCRIPTION
</h2>
431 <div class=
"sectionbody">
432 <div class=
"paragraph"><p>Submodules allow foreign repositories to be embedded within
433 a dedicated subdirectory of the source tree, always pointed
434 at a particular commit.
</p></div>
435 <div class=
"paragraph"><p>They are not to be confused with remotes, which are meant mainly
436 for branches of the same project; submodules are meant for
437 different projects you would like to make part of your source tree,
438 while the history of the two projects still stays completely
439 independent and you cannot modify the contents of the submodule
440 from within the main project.
441 If you want to merge the project histories and want to treat the
442 aggregated whole as a single project from then on, you may want to
443 add a remote for the other project and use the
<em>subtree
</em> merge strategy,
444 instead of treating the other project as a submodule. Directories
445 that come from both projects can be cloned and checked out as a whole
446 if you choose to go that route.
</p></div>
447 <div class=
"paragraph"><p>Submodules are composed from a so-called
<tt>gitlink
</tt> tree entry
448 in the main repository that refers to a particular commit object
449 within the inner repository that is completely separate.
450 A record in the
<tt>.gitmodules
</tt> file at the root of the source
451 tree assigns a logical name to the submodule and describes
452 the default URL the submodule shall be cloned from.
453 The logical name can be used for overriding this URL within your
454 local repository configuration (see
<em>submodule init
</em>).
</p></div>
455 <div class=
"paragraph"><p>This command will manage the tree entries and contents of the
456 gitmodules file for you, as well as inspect the status of your
457 submodules and update them.
458 When adding a new submodule to the tree, the
<em>add
</em> subcommand
459 is to be used. However, when pulling a tree containing submodules,
460 these will not be checked out by default;
461 the
<em>init
</em> and
<em>update
</em> subcommands will maintain submodules
462 checked out and at appropriate revision in your working tree.
463 You can briefly inspect the up-to-date status of your submodules
464 using the
<em>status
</em> subcommand and get a detailed overview of the
465 difference between the index and checkouts using the
<em>summary
</em>
466 subcommand.
</p></div>
468 <h2 id=
"_commands">COMMANDS
</h2>
469 <div class=
"sectionbody">
470 <div class=
"dlist"><dl>
476 Add the given repository as a submodule at the given path
477 to the changeset to be committed next to the current
478 project: the current project is termed the
"superproject".
480 <div class=
"paragraph"><p>This requires at least one argument:
<repository
>. The optional
481 argument
<path
> is the relative location for the cloned submodule
482 to exist in the superproject. If
<path
> is not given, the
483 "humanish" part of the source repository is used (
"repo" for
484 "/path/to/repo.git" and
"foo" for
"host.xz:foo/.git").
</p></div>
485 <div class=
"paragraph"><p><repository
> is the URL of the new submodule
’s origin repository.
486 This may be either an absolute URL, or (if it begins with ./
487 or ../), the location relative to the superproject
’s origin
488 repository.
</p></div>
489 <div class=
"paragraph"><p><path
> is the relative location for the cloned submodule to
490 exist in the superproject. If
<path
> does not exist, then the
491 submodule is created by cloning from the named URL. If
<path
> does
492 exist and is already a valid git repository, then this is added
493 to the changeset without cloning. This second form is provided
494 to ease creating a new submodule from scratch, and presumes
495 the user will later push the submodule to the given URL.
</p></div>
496 <div class=
"paragraph"><p>In either case, the given URL is recorded into .gitmodules for
497 use by subsequent users cloning the superproject. If the URL is
498 given relative to the superproject
’s repository, the presumption
499 is the superproject and submodule repositories will be kept
500 together in the same relative location, and only the
501 superproject
’s URL needs to be provided: git-submodule will correctly
502 locate the submodule using the relative URL in .gitmodules.
</p></div>
509 Show the status of the submodules. This will print the SHA-
1 of the
510 currently checked out commit for each submodule, along with the
511 submodule path and the output of
<em>git describe
</em> for the
512 SHA-
1. Each SHA-
1 will be prefixed with
<tt>-
</tt> if the submodule is not
513 initialized,
<tt>+
</tt> if the currently checked out submodule commit
514 does not match the SHA-
1 found in the index of the containing
515 repository and
<tt>U
</tt> if the submodule has merge conflicts.
516 This command is the default command for
<em>git submodule
</em>.
518 <div class=
"paragraph"><p>If
<em>--recursive
</em> is specified, this command will recurse into nested
519 submodules, and show their status as well.
</p></div>
526 Initialize the submodules, i.e. register each submodule name
527 and url found in .gitmodules into .git/config.
528 The key used in .git/config is
<tt>submodule.$name.url
</tt>.
529 This command does not alter existing information in .git/config.
530 You can then customize the submodule clone URLs in .git/config
531 for your local setup and proceed to
<tt>git submodule update
</tt>;
532 you can also just use
<tt>git submodule update --init
</tt> without
533 the explicit
<em>init
</em> step if you do not intend to customize
534 any submodule locations.
542 Update the registered submodules, i.e. clone missing submodules and
543 checkout the commit specified in the index of the containing repository.
544 This will make the submodules HEAD be detached unless
<em>--rebase
</em> or
545 <em>--merge
</em> is specified or the key
<tt>submodule.$name.update
</tt> is set to
546 <tt>rebase
</tt> or
<tt>merge
</tt>.
548 <div class=
"paragraph"><p>If the submodule is not yet initialized, and you just want to use the
549 setting as stored in .gitmodules, you can automatically initialize the
550 submodule with the --init option.
</p></div>
551 <div class=
"paragraph"><p>If
<em>--recursive
</em> is specified, this command will recurse into the
552 registered submodules, and update any nested submodules within.
</p></div>
559 Show commit summary between the given commit (defaults to HEAD) and
560 working tree/index. For a submodule in question, a series of commits
561 in the submodule between the given super project commit and the
562 index or working tree (switched by --cached) are shown. If the option
563 --files is given, show the series of commits in the submodule between
564 the index of the super project and the working tree of the submodule
565 (this option doesn
’t allow to use the --cached option or to provide an
574 Evaluates an arbitrary shell command in each checked out submodule.
575 The command has access to the variables $name, $path, $sha1 and
577 $name is the name of the relevant submodule section in .gitmodules,
578 $path is the name of the submodule directory relative to the
579 superproject, $sha1 is the commit as recorded in the superproject,
580 and $toplevel is the absolute path to the top-level of the superproject.
581 Any submodules defined in the superproject but not checked out are
582 ignored by this command. Unless given --quiet, foreach prints the name
583 of each submodule before evaluating the command.
584 If --recursive is given, submodules are traversed recursively (i.e.
585 the given shell command is evaluated in nested submodules as well).
586 A non-zero return from the command in any submodule causes
587 the processing to terminate. This can be overridden by adding
<em>|| :
</em>
588 to the end of the command.
590 <div class=
"paragraph"><p>As an example,
<tt>git submodule foreach 'echo $path
`git
591 rev-parse HEAD
`'
</tt> will show the path and currently checked out
592 commit for each submodule.
</p></div>
599 Synchronizes submodules' remote URL configuration setting
600 to the value specified in .gitmodules. This is useful when
601 submodule URLs change upstream and you need to update your local
602 repositories accordingly.
604 <div class=
"paragraph"><p>"git submodule sync" synchronizes all submodules while
605 "git submodule sync — A" synchronizes submodule
"A" only.
</p></div>
609 <h2 id=
"_options">OPTIONS
</h2>
610 <div class=
"sectionbody">
611 <div class=
"dlist"><dl>
620 Only print error messages.
631 Branch of repository to add as submodule.
642 This option is only valid for add and update commands.
643 When running add, allow adding an otherwise ignored submodule path.
644 When running update, throw away local changes in submodules when
645 switching to a different commit.
653 This option is only valid for status and summary commands. These
654 commands typically use the commit found in the submodule HEAD, but
655 with this option, the commit stored in the index is used instead.
663 This option is only valid for the summary command. This command
664 compares the commit in the index with that in the submodule HEAD
665 when this option is used.
676 This option is only valid for the summary command.
677 Limit the summary size (number of commits shown in total).
678 Giving
0 will disable the summary; a negative number means unlimited
679 (the default). This limit only applies to modified submodules. The
680 size is always limited to
1 for added/deleted/typechanged submodules.
691 This option is only valid for the update command.
692 Don
’t fetch new objects from the remote site.
700 This option is only valid for the update command.
701 Merge the commit recorded in the superproject into the current branch
702 of the submodule. If this option is given, the submodule
’s HEAD will
703 not be detached. If a merge failure prevents this process, you will
704 have to resolve the resulting conflicts within the submodule with the
705 usual conflict resolution tools.
706 If the key
<tt>submodule.$name.update
</tt> is set to
<tt>merge
</tt>, this option is
715 This option is only valid for the update command.
716 Rebase the current branch onto the commit recorded in the
717 superproject. If this option is given, the submodule
’s HEAD will not
718 be detached. If a merge failure prevents this process, you will have
719 to resolve these failures with
<a href=
"git-rebase.html">git-rebase(
1)
</a>.
720 If the key
<tt>submodule.$name.update
</tt> is set to
<tt>rebase
</tt>, this option is
725 --reference
<repository
>
729 This option is only valid for add and update commands. These
730 commands sometimes need to clone a remote repository. In this case,
731 this option will be passed to the
<a href=
"git-clone.html">git-clone(
1)
</a> command.
733 <div class=
"paragraph"><p><strong>NOTE
</strong>: Do
<strong>not
</strong> use this option unless you have read the note
734 for
<a href=
"git-clone.html">git-clone(
1)
</a>'s --reference and --shared options carefully.
</p></div>
741 This option is only valid for foreach, update and status commands.
742 Traverse submodules recursively. The operation is performed not
743 only in the submodules of the current repo, but also
744 in any nested submodules inside those submodules (and so on).
752 Paths to submodule(s). When specified this will restrict the command
753 to only operate on the submodules found at the specified paths.
754 (This argument is required with add).
759 <h2 id=
"_files">FILES
</h2>
760 <div class=
"sectionbody">
761 <div class=
"paragraph"><p>When initializing submodules, a .gitmodules file in the top-level directory
762 of the containing repository is used to find the url of each submodule.
763 This file should be formatted in the same way as
<tt>$GIT_DIR/config
</tt>. The key
764 to each submodule url is
"submodule.$name.url". See
<a href=
"gitmodules.html">gitmodules(
5)
</a>
765 for details.
</p></div>
767 <h2 id=
"_git">GIT
</h2>
768 <div class=
"sectionbody">
769 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
772 <div id=
"footer-text">
773 Last updated
2011-
05-
03 00:
48:
04 UTC