blob: ef9d9d28a9cc581574bd700e467c636996432caa [file] [log] [blame]
Lars Hjemli70c7ac22007-05-26 15:56:40 +02001git-submodule(1)
2================
3
4NAME
5----
6git-submodule - Initialize, update or inspect submodules
7
8
9SYNOPSIS
10--------
Matt Kraaib2493642007-07-06 17:56:31 -070011[verse]
Stefan Bellereb2f2f52016-12-27 15:43:08 -080012'git submodule' [--quiet] add [<options>] [--] <repository> [<path>]
Johan Herland64b19ff2009-08-19 03:45:24 +020013'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]
Jonathan Niederb1889c32008-06-30 01:09:04 -050014'git submodule' [--quiet] init [--] [<path>...]
Stefan Bellerf6a52792016-05-05 12:52:32 -070015'git submodule' [--quiet] deinit [-f|--force] (--all|[--] <path>...)
Stefan Bellereb2f2f52016-12-27 15:43:08 -080016'git submodule' [--quiet] update [<options>] [--] [<path>...]
17'git submodule' [--quiet] summary [<options>] [--] [<path>...]
Johan Herland15fc56a2009-08-19 03:45:22 +020018'git submodule' [--quiet] foreach [--recursive] <command>
Matthew Chen9393ae72014-06-13 13:40:50 -040019'git submodule' [--quiet] sync [--recursive] [--] [<path>...]
Stefan Bellerf6f85862016-12-12 11:04:35 -080020'git submodule' [--quiet] absorbgitdirs [--] [<path>...]
Lars Hjemli70c7ac22007-05-26 15:56:40 +020021
22
Petr Baudise38953a2008-07-16 20:44:12 +020023DESCRIPTION
24-----------
Stefan Bellerec48a762015-05-27 12:48:01 -070025Inspects, updates and manages submodules.
Petr Baudise38953a2008-07-16 20:44:12 +020026
Stefan Bellerd4803452017-06-22 14:01:49 -070027For more information about submodules, see linkgit:gitsubmodules[7].
Petr Baudise38953a2008-07-16 20:44:12 +020028
Lars Hjemli70c7ac22007-05-26 15:56:40 +020029COMMANDS
30--------
Stefan Bellereb2f2f52016-12-27 15:43:08 -080031add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--depth <depth>] [--] <repository> [<path>]::
Sven Verdoolaegeecda0722007-06-24 23:06:07 +020032 Add the given repository as a submodule at the given path
Mark Levedahlec05df32008-07-09 21:05:40 -040033 to the changeset to be committed next to the current
Cesar Eduardo Barros77ef80a2008-07-26 01:17:42 -030034 project: the current project is termed the "superproject".
Mark Levedahlec05df32008-07-09 21:05:40 -040035+
Mark Levedahlec05df32008-07-09 21:05:40 -040036<repository> is the URL of the new submodule's origin repository.
37This may be either an absolute URL, or (if it begins with ./
Stefan Bellerd1b3b812017-02-24 17:31:47 -080038or ../), the location relative to the superproject's default remote
Jens Lehmann9e6ed472012-01-01 16:13:16 +010039repository (Please note that to specify a repository 'foo.git'
40which is located right next to a superproject 'bar.git', you'll
41have to use '../foo.git' instead of './foo.git' - as one might expect
42when following the rules for relative URLs - because the evaluation
43of relative URLs in Git is identical to that of relative directories).
Stefan Bellerd1b3b812017-02-24 17:31:47 -080044+
Robert P. J. Day30aa96c2018-06-07 07:53:36 -040045The default remote is the remote of the remote-tracking branch
46of the current branch. If no such remote-tracking branch exists or
Stefan Bellerd1b3b812017-02-24 17:31:47 -080047the HEAD is detached, "origin" is assumed to be the default remote.
48If the superproject doesn't have a default remote configured
Jens Lehmann4d689322011-06-06 21:58:04 +020049the superproject is its own authoritative upstream and the current
50working directory is used instead.
Mark Levedahlec05df32008-07-09 21:05:40 -040051+
Kaartic Sivaraambeebc6d2017-06-22 02:51:42 +000052The optional argument <path> is the relative location for the cloned
53submodule to exist in the superproject. If <path> is not given, the
54canonical part of the source repository is used ("repo" for
55"/path/to/repo.git" and "foo" for "host.xz:foo/.git"). If <path>
56exists and is already a valid Git repository, then it is staged
57for commit without cloning. The <path> is also used as the submodule's
58logical name in its configuration entries unless `--name` is used
59to specify a logical name.
Mark Levedahlec05df32008-07-09 21:05:40 -040060+
Kaartic Sivaraambeebc6d2017-06-22 02:51:42 +000061The given URL is recorded into `.gitmodules` for use by subsequent users
62cloning the superproject. If the URL is given relative to the
63superproject's repository, the presumption is the superproject and
64submodule repositories will be kept together in the same relative
65location, and only the superproject's URL needs to be provided.
66git-submodule will correctly locate the submodule using the relative
67URL in `.gitmodules`.
Sven Verdoolaegeecda0722007-06-24 23:06:07 +020068
Stefan Bellereb2f2f52016-12-27 15:43:08 -080069status [--cached] [--recursive] [--] [<path>...]::
Lars Hjemli70c7ac22007-05-26 15:56:40 +020070 Show the status of the submodules. This will print the SHA-1 of the
71 currently checked out commit for each submodule, along with the
Thomas Rast0b444cd2010-01-10 00:33:00 +010072 submodule path and the output of 'git describe' for the
Kaartic Sivaraame1b3f3d2018-01-14 23:07:37 +053073 SHA-1. Each SHA-1 will possibly be prefixed with `-` if the submodule is
74 not initialized, `+` if the currently checked out submodule commit
Lars Hjemli70c7ac22007-05-26 15:56:40 +020075 does not match the SHA-1 found in the index of the containing
Nicolas Morey-Chaisemartin313ee0d2011-03-30 07:20:02 +020076 repository and `U` if the submodule has merge conflicts.
Johan Herland64b19ff2009-08-19 03:45:24 +020077+
Jens Lehmann402e8a62011-08-01 22:49:21 +020078If `--recursive` is specified, this command will recurse into nested
Johan Herland64b19ff2009-08-19 03:45:24 +020079submodules, and show their status as well.
Jens Lehmann402e8a62011-08-01 22:49:21 +020080+
81If you are only interested in changes of the currently initialized
82submodules with respect to the commit recorded in the index or the HEAD,
83linkgit:git-status[1] and linkgit:git-diff[1] will provide that information
84too (and can also report changes to a submodule's work tree).
Lars Hjemli70c7ac22007-05-26 15:56:40 +020085
Stefan Bellereb2f2f52016-12-27 15:43:08 -080086init [--] [<path>...]::
Dale R. Worley3244eb92013-05-15 18:28:39 -040087 Initialize the submodules recorded in the index (which were
Stefan Bellerd1b3b812017-02-24 17:31:47 -080088 added and committed elsewhere) by setting `submodule.$name.url`
Kaartic Sivaraambeebc6d2017-06-22 02:51:42 +000089 in .git/config. It uses the same setting from `.gitmodules` as
Stefan Bellerd1b3b812017-02-24 17:31:47 -080090 a template. If the URL is relative, it will be resolved using
91 the default remote. If there is no default remote, the current
92 repository will be assumed to be upstream.
93+
94Optional <path> arguments limit which submodules will be initialized.
Brandon Williams3e7eaed2017-03-17 15:38:02 -070095If no path is specified and submodule.active has been configured, submodules
96configured to be active will be initialized, otherwise all submodules are
97initialized.
Stefan Bellerd1b3b812017-02-24 17:31:47 -080098+
99When present, it will also copy the value of `submodule.$name.update`.
100This command does not alter existing information in .git/config.
101You can then customize the submodule clone URLs in .git/config
102for your local setup and proceed to `git submodule update`;
103you can also just use `git submodule update --init` without
104the explicit 'init' step if you do not intend to customize
105any submodule locations.
106+
Ville Skyttä64127572017-06-25 13:20:41 +0300107See the add subcommand for the definition of default remote.
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200108
Stefan Bellereb2f2f52016-12-27 15:43:08 -0800109deinit [-f|--force] (--all|[--] <path>...)::
Jens Lehmanncf419822013-03-04 22:20:24 +0100110 Unregister the given submodules, i.e. remove the whole
111 `submodule.$name` section from .git/config together with their work
112 tree. Further calls to `git submodule update`, `git submodule foreach`
113 and `git submodule sync` will skip any unregistered submodules until
114 they are initialized again, so use this command if you don't want to
Stefan Bellerd4803452017-06-22 14:01:49 -0700115 have a local checkout of the submodule in your working tree anymore.
Jens Lehmanncf419822013-03-04 22:20:24 +0100116+
Stefan Bellerf6a52792016-05-05 12:52:32 -0700117When the command is run without pathspec, it errors out,
118instead of deinit-ing everything, to prevent mistakes.
119+
120If `--force` is specified, the submodule's working tree will
121be removed even if it contains local modifications.
Stefan Bellerd4803452017-06-22 14:01:49 -0700122+
123If you really want to remove a submodule from the repository and commit
124that use linkgit:git-rm[1] instead. See linkgit:gitsubmodules[7] for removal
125options.
Jens Lehmanncf419822013-03-04 22:20:24 +0100126
Stefan Bellereb2f2f52016-12-27 15:43:08 -0800127update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference <repository>] [--depth <depth>] [--recursive] [--jobs <n>] [--] [<path>...]::
Johannes Schindelinbe4d2c82008-05-16 11:23:03 +0100128+
Michal Sojka5c31acf2015-03-02 23:57:58 +0100129--
130Update the registered submodules to match what the superproject
131expects by cloning missing submodules and updating the working tree of
132the submodules. The "updating" can be done in several ways depending
133on command line options and the value of `submodule.<name>.update`
Stefan Bellerfc01a5d2016-12-27 15:43:09 -0800134configuration variable. The command line option takes precedence over
Kaartic Sivaraame1b3f3d2018-01-14 23:07:37 +0530135the configuration variable. If neither is given, a 'checkout' is performed.
136The 'update' procedures supported both from the command line as well as
137through the `submodule.<name>.update` configuration are:
Michal Sojka5c31acf2015-03-02 23:57:58 +0100138
139 checkout;; the commit recorded in the superproject will be
Stefan Bellerfc01a5d2016-12-27 15:43:09 -0800140 checked out in the submodule on a detached HEAD.
Michal Sojka5c31acf2015-03-02 23:57:58 +0100141+
142If `--force` is specified, the submodule will be checked out (using
Kaartic Sivaraame1b3f3d2018-01-14 23:07:37 +0530143`git checkout --force`), even if the commit specified
Michal Sojka5c31acf2015-03-02 23:57:58 +0100144in the index of the containing repository already matches the commit
145checked out in the submodule.
146
147 rebase;; the current branch of the submodule will be rebased
Stefan Bellerfc01a5d2016-12-27 15:43:09 -0800148 onto the commit recorded in the superproject.
Michal Sojka5c31acf2015-03-02 23:57:58 +0100149
150 merge;; the commit recorded in the superproject will be merged
Stefan Bellerfc01a5d2016-12-27 15:43:09 -0800151 into the current branch in the submodule.
152
Kaartic Sivaraame1b3f3d2018-01-14 23:07:37 +0530153The following 'update' procedures are only available via the
154`submodule.<name>.update` configuration variable:
Michal Sojka5c31acf2015-03-02 23:57:58 +0100155
156 custom command;; arbitrary shell command that takes a single
157 argument (the sha1 of the commit recorded in the
Stefan Bellerfc01a5d2016-12-27 15:43:09 -0800158 superproject) is executed. When `submodule.<name>.update`
159 is set to '!command', the remainder after the exclamation mark
160 is the custom command.
Michal Sojka5c31acf2015-03-02 23:57:58 +0100161
Stefan Bellerfc01a5d2016-12-27 15:43:09 -0800162 none;; the submodule is not updated.
Michal Sojka5c31acf2015-03-02 23:57:58 +0100163
Johannes Schindelinbe4d2c82008-05-16 11:23:03 +0100164If the submodule is not yet initialized, and you just want to use the
Kaartic Sivaraambeebc6d2017-06-22 02:51:42 +0000165setting as stored in `.gitmodules`, you can automatically initialize the
Jens Lehmann402e8a62011-08-01 22:49:21 +0200166submodule with the `--init` option.
Michal Sojka5c31acf2015-03-02 23:57:58 +0100167
Jens Lehmann402e8a62011-08-01 22:49:21 +0200168If `--recursive` is specified, this command will recurse into the
Johan Herlandb13fd5c2009-08-19 03:45:23 +0200169registered submodules, and update any nested submodules within.
Michal Sojka5c31acf2015-03-02 23:57:58 +0100170--
Stefan Bellereb2f2f52016-12-27 15:43:08 -0800171summary [--cached|--files] [(-n|--summary-limit) <n>] [commit] [--] [<path>...]::
Ping Yin925e7f62008-03-11 21:52:18 +0800172 Show commit summary between the given commit (defaults to HEAD) and
173 working tree/index. For a submodule in question, a series of commits
174 in the submodule between the given super project commit and the
Jens Lehmann402e8a62011-08-01 22:49:21 +0200175 index or working tree (switched by `--cached`) are shown. If the option
176 `--files` is given, show the series of commits in the submodule between
Lars Hjemlief92e1a2009-08-15 10:40:42 +0200177 the index of the super project and the working tree of the submodule
Jens Lehmann402e8a62011-08-01 22:49:21 +0200178 (this option doesn't allow to use the `--cached` option or to provide an
Jens Lehmann1c244f62009-08-13 21:32:50 +0200179 explicit commit).
Jens Lehmann402e8a62011-08-01 22:49:21 +0200180+
181Using the `--submodule=log` option with linkgit:git-diff[1] will provide that
182information too.
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200183
Stefan Bellereb2f2f52016-12-27 15:43:08 -0800184foreach [--recursive] <command>::
Mark Levedahl19a31f92008-08-10 19:10:04 -0400185 Evaluates an arbitrary shell command in each checked out submodule.
Ævar Arnfjörð Bjarmasonf030c962010-05-21 16:10:10 +0000186 The command has access to the variables $name, $path, $sha1 and
187 $toplevel:
Kaartic Sivaraambeebc6d2017-06-22 02:51:42 +0000188 $name is the name of the relevant submodule section in `.gitmodules`,
Mark Levedahl19a31f92008-08-10 19:10:04 -0400189 $path is the name of the submodule directory relative to the
Ævar Arnfjörð Bjarmasonf030c962010-05-21 16:10:10 +0000190 superproject, $sha1 is the commit as recorded in the superproject,
191 and $toplevel is the absolute path to the top-level of the superproject.
Mark Levedahl19a31f92008-08-10 19:10:04 -0400192 Any submodules defined in the superproject but not checked out are
Jens Lehmann402e8a62011-08-01 22:49:21 +0200193 ignored by this command. Unless given `--quiet`, foreach prints the name
Mark Levedahl19a31f92008-08-10 19:10:04 -0400194 of each submodule before evaluating the command.
Jens Lehmann402e8a62011-08-01 22:49:21 +0200195 If `--recursive` is given, submodules are traversed recursively (i.e.
Johan Herland15fc56a2009-08-19 03:45:22 +0200196 the given shell command is evaluated in nested submodules as well).
Mark Levedahl19a31f92008-08-10 19:10:04 -0400197 A non-zero return from the command in any submodule causes
198 the processing to terminate. This can be overridden by adding '|| :'
199 to the end of the command.
200+
Jeff Kinge91461b2017-02-13 16:05:49 -0500201As an example, the command below will show the path and currently
202checked out commit for each submodule:
203+
204--------------
205git submodule foreach 'echo $path `git rev-parse HEAD`'
206--------------
Mark Levedahl19a31f92008-08-10 19:10:04 -0400207
Stefan Bellereb2f2f52016-12-27 15:43:08 -0800208sync [--recursive] [--] [<path>...]::
David Aguilar2327f612008-08-24 12:43:37 -0700209 Synchronizes submodules' remote URL configuration setting
Kaartic Sivaraambeebc6d2017-06-22 02:51:42 +0000210 to the value specified in `.gitmodules`. It will only affect those
Jim Meyeringa7793a72012-03-28 10:41:54 +0200211 submodules which already have a URL entry in .git/config (that is the
Junio C Hamanoccee6082011-06-25 22:41:25 +0200212 case when they are initialized or freshly added). This is useful when
David Aguilar2327f612008-08-24 12:43:37 -0700213 submodule URLs change upstream and you need to update your local
214 repositories accordingly.
215+
Martin Ågren4c57a4f2018-04-17 21:15:29 +0200216`git submodule sync` synchronizes all submodules while
217`git submodule sync -- A` synchronizes submodule "A" only.
Stefan Bellere7220c42015-12-03 12:41:02 -0800218+
219If `--recursive` is specified, this command will recurse into the
220registered submodules, and sync any nested submodules within.
Mark Levedahl19a31f92008-08-10 19:10:04 -0400221
Stefan Bellerf6f85862016-12-12 11:04:35 -0800222absorbgitdirs::
223 If a git directory of a submodule is inside the submodule,
224 move the git directory of the submodule into its superprojects
225 `$GIT_DIR/modules` path and then connect the git directory and
226 its working directory by setting the `core.worktree` and adding
227 a .git file pointing to the git directory embedded in the
228 superprojects git directory.
229+
230A repository that was cloned independently and later added as a submodule or
231old setups have the submodules git directory inside the submodule instead of
232embedded into the superprojects git directory.
233+
234This command is recursive by default.
235
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200236OPTIONS
237-------
Stephan Beyer32402402008-06-08 03:36:09 +0200238-q::
239--quiet::
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200240 Only print error messages.
241
Casey Fitzpatrick6d33e1c2018-05-03 06:53:45 -0400242--progress::
243 This option is only valid for add and update commands.
244 Progress status is reported on the standard error stream
245 by default when it is attached to a terminal, unless -q
246 is specified. This flag forces progress status even if the
247 standard error stream is not directed to a terminal.
248
Stefan Bellerf6a52792016-05-05 12:52:32 -0700249--all::
250 This option is only valid for the deinit command. Unregister all
251 submodules in the working tree.
252
Stephan Beyer32402402008-06-08 03:36:09 +0200253-b::
254--branch::
Sven Verdoolaegeecda0722007-06-24 23:06:07 +0200255 Branch of repository to add as submodule.
W. Trevor King15d64932014-03-27 14:06:20 -0700256 The name of the branch is recorded as `submodule.<name>.branch` in
Brandon Williams15ef7802016-10-19 13:42:54 -0700257 `.gitmodules` for `update --remote`. A special value of `.` is used to
258 indicate that the name of the branch in the submodule should be the
259 same name as the current branch in the current repository.
Sven Verdoolaegeecda0722007-06-24 23:06:07 +0200260
Jens Lehmannd27b8762010-07-17 17:11:43 +0200261-f::
262--force::
Jens Lehmanncf419822013-03-04 22:20:24 +0100263 This option is only valid for add, deinit and update commands.
Nicolas Morey-Chaisemartin9db31bd2011-04-01 11:42:03 +0200264 When running add, allow adding an otherwise ignored submodule path.
Stefan Bellerf6a52792016-05-05 12:52:32 -0700265 When running deinit the submodule working trees will be removed even
266 if they contain local changes.
Michal Sojka5c31acf2015-03-02 23:57:58 +0100267 When running update (only effective with the checkout procedure),
268 throw away local changes in submodules when switching to a
269 different commit; and always run a checkout operation in the
270 submodule, even if the commit listed in the index of the
271 containing repository matches the commit checked out in the
272 submodule.
Jens Lehmannd27b8762010-07-17 17:11:43 +0200273
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200274--cached::
Ping Yin925e7f62008-03-11 21:52:18 +0800275 This option is only valid for status and summary commands. These
276 commands typically use the commit found in the submodule HEAD, but
277 with this option, the commit stored in the index is used instead.
278
Jens Lehmann1c244f62009-08-13 21:32:50 +0200279--files::
280 This option is only valid for the summary command. This command
281 compares the commit in the index with that in the submodule HEAD
282 when this option is used.
283
Stephan Beyer32402402008-06-08 03:36:09 +0200284-n::
285--summary-limit::
Ping Yin925e7f62008-03-11 21:52:18 +0800286 This option is only valid for the summary command.
287 Limit the summary size (number of commits shown in total).
Junio C Hamano51836e92008-04-12 18:34:39 -0700288 Giving 0 will disable the summary; a negative number means unlimited
Ping Yin925e7f62008-03-11 21:52:18 +0800289 (the default). This limit only applies to modified submodules. The
290 size is always limited to 1 for added/deleted/typechanged submodules.
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200291
W. Trevor King06b1abb2012-12-19 11:03:32 -0500292--remote::
293 This option is only valid for the update command. Instead of using
294 the superproject's recorded SHA-1 to update the submodule, use the
Michael Schubertd6ac1d22013-07-03 11:12:34 +0200295 status of the submodule's remote-tracking branch. The remote used
W. Trevor King06b1abb2012-12-19 11:03:32 -0500296 is branch's remote (`branch.<name>.remote`), defaulting to `origin`.
297 The remote branch used defaults to `master`, but the branch name may
298 be overridden by setting the `submodule.<name>.branch` option in
299 either `.gitmodules` or `.git/config` (with `.git/config` taking
300 precedence).
301+
302This works for any of the supported update procedures (`--checkout`,
303`--rebase`, etc.). The only change is the source of the target SHA-1.
304For example, `submodule update --remote --merge` will merge upstream
305submodule changes into the submodules, while `submodule update
306--merge` will merge superproject gitlink changes into the submodules.
307+
308In order to ensure a current tracking branch state, `update --remote`
309fetches the submodule's remote repository before calculating the
310SHA-1. If you don't want to fetch, you should use `submodule update
311--remote --no-fetch`.
W. Trevor King9937e652014-01-26 12:45:16 -0800312+
313Use this option to integrate changes from the upstream subproject with
314your submodule's current HEAD. Alternatively, you can run `git pull`
315from the submodule, which is equivalent except for the remote branch
316name: `update --remote` uses the default upstream repository and
317`submodule.<name>.branch`, while `git pull` uses the submodule's
318`branch.<name>.merge`. Prefer `submodule.<name>.branch` if you want
319to distribute the default upstream branch with the superproject and
320`branch.<name>.merge` if you want a more native feel while working in
321the submodule itself.
W. Trevor King06b1abb2012-12-19 11:03:32 -0500322
Fabian Franz31ca3ac2009-02-05 20:18:32 -0200323-N::
324--no-fetch::
325 This option is only valid for the update command.
326 Don't fetch new objects from the remote site.
327
Jens Lehmann893a9762014-02-28 22:41:11 +0000328--checkout::
329 This option is only valid for the update command.
330 Checkout the commit recorded in the superproject on a detached HEAD
331 in the submodule. This is the default behavior, the main use of
332 this option is to override `submodule.$name.update` when set to
Michal Sojka5c31acf2015-03-02 23:57:58 +0100333 a value other than `checkout`.
Jens Lehmann893a9762014-02-28 22:41:11 +0000334 If the key `submodule.$name.update` is either not explicitly set or
335 set to `checkout`, this option is implicit.
336
Johan Herland42b49172009-06-03 00:59:12 +0200337--merge::
338 This option is only valid for the update command.
339 Merge the commit recorded in the superproject into the current branch
340 of the submodule. If this option is given, the submodule's HEAD will
341 not be detached. If a merge failure prevents this process, you will
342 have to resolve the resulting conflicts within the submodule with the
343 usual conflict resolution tools.
344 If the key `submodule.$name.update` is set to `merge`, this option is
345 implicit.
346
Peter Huttererca2cedb2009-04-24 09:06:38 +1000347--rebase::
348 This option is only valid for the update command.
349 Rebase the current branch onto the commit recorded in the
350 superproject. If this option is given, the submodule's HEAD will not
Ralf Wildenhues6a5d0b02010-01-31 14:24:39 +0100351 be detached. If a merge failure prevents this process, you will have
Peter Huttererca2cedb2009-04-24 09:06:38 +1000352 to resolve these failures with linkgit:git-rebase[1].
Johan Herland32948422009-06-03 08:27:06 +0200353 If the key `submodule.$name.update` is set to `rebase`, this option is
Peter Huttererca2cedb2009-04-24 09:06:38 +1000354 implicit.
355
Jens Lehmann402e8a62011-08-01 22:49:21 +0200356--init::
357 This option is only valid for the update command.
358 Initialize all submodules for which "git submodule init" has not been
359 called so far before updating.
360
Jens Lehmann73b08982012-09-30 01:05:58 +0200361--name::
362 This option is only valid for the add command. It sets the submodule's
363 name to the given string instead of defaulting to its path. The name
364 must be valid as a directory name and may not end with a '/'.
365
Michael S. Tsirkind92a3952009-05-04 22:30:01 +0300366--reference <repository>::
367 This option is only valid for add and update commands. These
368 commands sometimes need to clone a remote repository. In this case,
369 this option will be passed to the linkgit:git-clone[1] command.
370+
371*NOTE*: Do *not* use this option unless you have read the note
Casey Fitzpatricka0ef2932018-05-03 06:53:46 -0400372for linkgit:git-clone[1]'s `--reference`, `--shared`, and `--dissociate`
373options carefully.
374
375--dissociate::
376 This option is only valid for add and update commands. These
377 commands sometimes need to clone a remote repository. In this case,
378 this option will be passed to the linkgit:git-clone[1] command.
379+
380*NOTE*: see the NOTE for the `--reference` option.
Michael S. Tsirkind92a3952009-05-04 22:30:01 +0300381
Johan Herland15fc56a2009-08-19 03:45:22 +0200382--recursive::
Stefan Bellere7220c42015-12-03 12:41:02 -0800383 This option is only valid for foreach, update, status and sync commands.
Johan Herland15fc56a2009-08-19 03:45:22 +0200384 Traverse submodules recursively. The operation is performed not
385 only in the submodules of the current repo, but also
386 in any nested submodules inside those submodules (and so on).
387
Fredrik Gustafsson275cd182013-07-02 23:42:56 +0200388--depth::
389 This option is valid for add and update commands. Create a 'shallow'
390 clone with a history truncated to the specified number of revisions.
391 See linkgit:git-clone[1]
392
Stefan Bellerabed0002016-05-26 14:59:43 -0700393--[no-]recommend-shallow::
394 This option is only valid for the update command.
395 The initial clone of a submodule will use the recommended
Kaartic Sivaraambeebc6d2017-06-22 02:51:42 +0000396 `submodule.<name>.shallow` as provided by the `.gitmodules` file
Stefan Bellerabed0002016-05-26 14:59:43 -0700397 by default. To ignore the suggestions use `--no-recommend-shallow`.
398
Stefan Beller2335b872016-02-29 18:07:19 -0800399-j <n>::
400--jobs <n>::
401 This option is only valid for the update command.
402 Clone new submodules in parallel with as many jobs.
403 Defaults to the `submodule.fetchJobs` option.
Fredrik Gustafsson275cd182013-07-02 23:42:56 +0200404
Abhijit Menon-Senf448e242008-07-30 15:03:43 +0530405<path>...::
406 Paths to submodule(s). When specified this will restrict the command
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200407 to only operate on the submodules found at the specified paths.
Mark Levedahlec05df32008-07-09 21:05:40 -0400408 (This argument is required with add).
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200409
410FILES
411-----
Kaartic Sivaraambeebc6d2017-06-22 02:51:42 +0000412When initializing submodules, a `.gitmodules` file in the top-level directory
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200413of the containing repository is used to find the url of each submodule.
Junio C Hamanoc4585702007-12-27 23:29:53 -0800414This file should be formatted in the same way as `$GIT_DIR/config`. The key
Dan McGee5162e692007-12-29 00:20:38 -0600415to each submodule url is "submodule.$name.url". See linkgit:gitmodules[5]
Junio C Hamano6fbe42c2007-12-16 22:03:21 -0800416for details.
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200417
Stefan Bellerd4803452017-06-22 14:01:49 -0700418SEE ALSO
419--------
420linkgit:gitsubmodules[7], linkgit:gitmodules[5].
421
Lars Hjemli70c7ac22007-05-26 15:56:40 +0200422GIT
423---
Christian Couder9e1f0a82008-06-06 09:07:32 +0200424Part of the linkgit:git[1] suite