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 and
<tt>+
</tt> if the currently checked out submodule commit
514 does not match the SHA-
1 found in the index of the containing
515 repository. This command is the default command for
<em>git submodule
</em>.
517 <div class=
"paragraph"><p>If
<em>--recursive
</em> is specified, this command will recurse into nested
518 submodules, and show their status as well.
</p></div>
525 Initialize the submodules, i.e. register each submodule name
526 and url found in .gitmodules into .git/config.
527 The key used in .git/config is
<tt>submodule.$name.url
</tt>.
528 This command does not alter existing information in .git/config.
529 You can then customize the submodule clone URLs in .git/config
530 for your local setup and proceed to
<tt>git submodule update
</tt>;
531 you can also just use
<tt>git submodule update --init
</tt> without
532 the explicit
<em>init
</em> step if you do not intend to customize
533 any submodule locations.
541 Update the registered submodules, i.e. clone missing submodules and
542 checkout the commit specified in the index of the containing repository.
543 This will make the submodules HEAD be detached unless
<em>--rebase
</em> or
544 <em>--merge
</em> is specified or the key
<tt>submodule.$name.update
</tt> is set to
545 <tt>rebase
</tt> or
<tt>merge
</tt>.
547 <div class=
"paragraph"><p>If the submodule is not yet initialized, and you just want to use the
548 setting as stored in .gitmodules, you can automatically initialize the
549 submodule with the --init option.
</p></div>
550 <div class=
"paragraph"><p>If
<em>--recursive
</em> is specified, this command will recurse into the
551 registered submodules, and update any nested submodules within.
</p></div>
558 Show commit summary between the given commit (defaults to HEAD) and
559 working tree/index. For a submodule in question, a series of commits
560 in the submodule between the given super project commit and the
561 index or working tree (switched by --cached) are shown. If the option
562 --files is given, show the series of commits in the submodule between
563 the index of the super project and the working tree of the submodule
564 (this option doesn
’t allow to use the --cached option or to provide an
573 Evaluates an arbitrary shell command in each checked out submodule.
574 The command has access to the variables $name, $path, $sha1 and
576 $name is the name of the relevant submodule section in .gitmodules,
577 $path is the name of the submodule directory relative to the
578 superproject, $sha1 is the commit as recorded in the superproject,
579 and $toplevel is the absolute path to the top-level of the superproject.
580 Any submodules defined in the superproject but not checked out are
581 ignored by this command. Unless given --quiet, foreach prints the name
582 of each submodule before evaluating the command.
583 If --recursive is given, submodules are traversed recursively (i.e.
584 the given shell command is evaluated in nested submodules as well).
585 A non-zero return from the command in any submodule causes
586 the processing to terminate. This can be overridden by adding
<em>|| :
</em>
587 to the end of the command.
589 <div class=
"paragraph"><p>As an example,
<tt>git submodule foreach 'echo $path
`git
590 rev-parse HEAD
`'
</tt> will show the path and currently checked out
591 commit for each submodule.
</p></div>
598 Synchronizes submodules' remote URL configuration setting
599 to the value specified in .gitmodules. This is useful when
600 submodule URLs change upstream and you need to update your local
601 repositories accordingly.
603 <div class=
"paragraph"><p>"git submodule sync" synchronizes all submodules while
604 "git submodule sync — A" synchronizes submodule
"A" only.
</p></div>
608 <h2 id=
"_options">OPTIONS
</h2>
609 <div class=
"sectionbody">
610 <div class=
"dlist"><dl>
619 Only print error messages.
630 Branch of repository to add as submodule.
641 This option is only valid for the add command.
642 Allow adding an otherwise ignored submodule path.
650 This option is only valid for status and summary commands. These
651 commands typically use the commit found in the submodule HEAD, but
652 with this option, the commit stored in the index is used instead.
660 This option is only valid for the summary command. This command
661 compares the commit in the index with that in the submodule HEAD
662 when this option is used.
673 This option is only valid for the summary command.
674 Limit the summary size (number of commits shown in total).
675 Giving
0 will disable the summary; a negative number means unlimited
676 (the default). This limit only applies to modified submodules. The
677 size is always limited to
1 for added/deleted/typechanged submodules.
688 This option is only valid for the update command.
689 Don
’t fetch new objects from the remote site.
697 This option is only valid for the update command.
698 Merge the commit recorded in the superproject into the current branch
699 of the submodule. If this option is given, the submodule
’s HEAD will
700 not be detached. If a merge failure prevents this process, you will
701 have to resolve the resulting conflicts within the submodule with the
702 usual conflict resolution tools.
703 If the key
<tt>submodule.$name.update
</tt> is set to
<tt>merge
</tt>, this option is
712 This option is only valid for the update command.
713 Rebase the current branch onto the commit recorded in the
714 superproject. If this option is given, the submodule
’s HEAD will not
715 be detached. If a merge failure prevents this process, you will have
716 to resolve these failures with
<a href=
"git-rebase.html">git-rebase(
1)
</a>.
717 If the key
<tt>submodule.$name.update
</tt> is set to
<tt>rebase
</tt>, this option is
722 --reference
<repository
>
726 This option is only valid for add and update commands. These
727 commands sometimes need to clone a remote repository. In this case,
728 this option will be passed to the
<a href=
"git-clone.html">git-clone(
1)
</a> command.
730 <div class=
"paragraph"><p><strong>NOTE
</strong>: Do
<strong>not
</strong> use this option unless you have read the note
731 for
<a href=
"git-clone.html">git-clone(
1)
</a>'s --reference and --shared options carefully.
</p></div>
738 This option is only valid for foreach, update and status commands.
739 Traverse submodules recursively. The operation is performed not
740 only in the submodules of the current repo, but also
741 in any nested submodules inside those submodules (and so on).
749 Paths to submodule(s). When specified this will restrict the command
750 to only operate on the submodules found at the specified paths.
751 (This argument is required with add).
756 <h2 id=
"_files">FILES
</h2>
757 <div class=
"sectionbody">
758 <div class=
"paragraph"><p>When initializing submodules, a .gitmodules file in the top-level directory
759 of the containing repository is used to find the url of each submodule.
760 This file should be formatted in the same way as
<tt>$GIT_DIR/config
</tt>. The key
761 to each submodule url is
"submodule.$name.url". See
<a href=
"gitmodules.html">gitmodules(
5)
</a>
762 for details.
</p></div>
764 <h2 id=
"_author">AUTHOR
</h2>
765 <div class=
"sectionbody">
766 <div class=
"paragraph"><p>Written by Lars Hjemli
<<a href=
"mailto:hjemli@gmail.com">hjemli@gmail.com
</a>></p></div>
768 <h2 id=
"_git">GIT
</h2>
769 <div class=
"sectionbody">
770 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
773 <div id=
"footer-text">
774 Last updated
2010-
07-
19 20:
25:
56 UTC