blob: 87d8e0f0c563b74acc880c2b7bee3c2c94086d05 [file] [log] [blame]
Junio C Hamano38b693c2007-06-03 08:40:141git-submodule(1)
2================
3
4NAME
5----
6git-submodule - Initialize, update or inspect submodules
7
8
9SYNOPSIS
10--------
Junio C Hamano7a4a2832007-07-07 21:53:2211[verse]
Junio C Hamano11f15372019-03-07 03:17:0012'git submodule' [--quiet] [--cached]
Junio C Hamanoe89102f2017-02-15 23:18:1513'git submodule' [--quiet] add [<options>] [--] <repository> [<path>]
Junio C Hamano0e066b92009-08-28 01:08:4114'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]
Junio C Hamanofce7c7e2008-07-02 03:06:3815'git submodule' [--quiet] init [--] [<path>...]
Junio C Hamano198b1f12016-05-17 22:27:2416'git submodule' [--quiet] deinit [-f|--force] (--all|[--] <path>...)
Junio C Hamanoe89102f2017-02-15 23:18:1517'git submodule' [--quiet] update [<options>] [--] [<path>...]
Junio C Hamano2ba14712019-04-25 10:12:2718'git submodule' [--quiet] set-branch [<options>] [--] <path>
Junio C Hamanob4896852019-12-10 23:15:0919'git submodule' [--quiet] set-url [--] <path> <newurl>
Junio C Hamanoe89102f2017-02-15 23:18:1520'git submodule' [--quiet] summary [<options>] [--] [<path>...]
Junio C Hamano0e066b92009-08-28 01:08:4121'git submodule' [--quiet] foreach [--recursive] <command>
Junio C Hamano38d02532014-06-26 21:48:5022'git submodule' [--quiet] sync [--recursive] [--] [<path>...]
Junio C Hamano56ace3d2017-01-10 23:43:4123'git submodule' [--quiet] absorbgitdirs [--] [<path>...]
Junio C Hamano38b693c2007-06-03 08:40:1424
25
Junio C Hamanof69a0a02008-07-17 08:08:4726DESCRIPTION
27-----------
Junio C Hamano8c5d5942015-06-11 19:37:4828Inspects, updates and manages submodules.
Junio C Hamanof69a0a02008-07-17 08:08:4729
Junio C Hamano387ce232017-07-12 23:01:1330For more information about submodules, see linkgit:gitsubmodules[7].
Junio C Hamanof69a0a02008-07-17 08:08:4731
Junio C Hamano38b693c2007-06-03 08:40:1432COMMANDS
33--------
Junio C Hamano11f15372019-03-07 03:17:0034With no arguments, shows the status of existing submodules. Several
35subcommands are available to perform operations on the submodules.
36
Junio C Hamanocd639fa2024-08-16 17:29:5837add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--ref-format <format>] [--depth <depth>] [--] <repository> [<path>]::
Junio C Hamano1d90cb02007-07-03 07:05:3138Add the given repository as a submodule at the given path
Junio C Hamano38ddcce2008-07-15 15:49:0339to the changeset to be committed next to the current
Junio C Hamano85c71572008-07-28 00:03:3140project: the current project is termed the "superproject".
Junio C Hamano38ddcce2008-07-15 15:49:0341+
Junio C Hamano38ddcce2008-07-15 15:49:0342<repository> is the URL of the new submodule's origin repository.
43This may be either an absolute URL, or (if it begins with ./
Junio C Hamano53eec4d2017-03-10 23:02:3644or ../), the location relative to the superproject's default remote
Junio C Hamanodb472bc2012-01-04 00:22:3745repository (Please note that to specify a repository 'foo.git'
46which is located right next to a superproject 'bar.git', you'll
Junio C Hamanob5513772019-04-22 03:38:3947have to use `../foo.git` instead of `./foo.git` - as one might expect
Junio C Hamanodb472bc2012-01-04 00:22:3748when following the rules for relative URLs - because the evaluation
49of relative URLs in Git is identical to that of relative directories).
Junio C Hamano53eec4d2017-03-10 23:02:3650+
Junio C Hamano14e66832018-06-18 18:32:1951The default remote is the remote of the remote-tracking branch
52of the current branch. If no such remote-tracking branch exists or
Junio C Hamano53eec4d2017-03-10 23:02:3653the HEAD is detached, "origin" is assumed to be the default remote.
54If the superproject doesn't have a default remote configured
Junio C Hamano15567bc2011-07-23 00:51:5955the superproject is its own authoritative upstream and the current
56working directory is used instead.
Junio C Hamano38ddcce2008-07-15 15:49:0357+
Junio C Hamano967cda72017-06-30 21:49:5358The optional argument <path> is the relative location for the cloned
59submodule to exist in the superproject. If <path> is not given, the
60canonical part of the source repository is used ("repo" for
61"/path/to/repo.git" and "foo" for "host.xz:foo/.git"). If <path>
62exists and is already a valid Git repository, then it is staged
63for commit without cloning. The <path> is also used as the submodule's
64logical name in its configuration entries unless `--name` is used
65to specify a logical name.
Junio C Hamano38ddcce2008-07-15 15:49:0366+
Junio C Hamano967cda72017-06-30 21:49:5367The given URL is recorded into `.gitmodules` for use by subsequent users
68cloning the superproject. If the URL is given relative to the
69superproject's repository, the presumption is the superproject and
70submodule repositories will be kept together in the same relative
71location, and only the superproject's URL needs to be provided.
72git-submodule will correctly locate the submodule using the relative
73URL in `.gitmodules`.
Junio C Hamanocd639fa2024-08-16 17:29:5874+
75If `--ref-format <format>` is specified, the ref storage format of newly
76cloned submodules will be set accordingly.
Junio C Hamano1d90cb02007-07-03 07:05:3177
Junio C Hamanoe89102f2017-02-15 23:18:1578status [--cached] [--recursive] [--] [<path>...]::
Junio C Hamano38b693c2007-06-03 08:40:1479Show the status of the submodules. This will print the SHA-1 of the
80currently checked out commit for each submodule, along with the
Junio C Hamano1aa40d22010-01-21 17:46:4381submodule path and the output of 'git describe' for the
Junio C Hamano640779d2018-02-14 01:29:1482SHA-1. Each SHA-1 will possibly be prefixed with `-` if the submodule is
83not initialized, `+` if the currently checked out submodule commit
Junio C Hamano38b693c2007-06-03 08:40:1484does not match the SHA-1 found in the index of the containing
Junio C Hamano5cd15182011-04-05 00:21:1085repository and `U` if the submodule has merge conflicts.
Junio C Hamano0e066b92009-08-28 01:08:4186+
Junio C Hamanob3f862c2019-12-05 22:22:0087If `--cached` is specified, this command will instead print the SHA-1
88recorded in the superproject for each submodule.
89+
Junio C Hamanoe1296e92011-08-08 22:58:1590If `--recursive` is specified, this command will recurse into nested
Junio C Hamano0e066b92009-08-28 01:08:4191submodules, and show their status as well.
Junio C Hamanoe1296e92011-08-08 22:58:1592+
93If you are only interested in changes of the currently initialized
94submodules with respect to the commit recorded in the index or the HEAD,
95linkgit:git-status[1] and linkgit:git-diff[1] will provide that information
96too (and can also report changes to a submodule's work tree).
Junio C Hamano38b693c2007-06-03 08:40:1497
Junio C Hamanoe89102f2017-02-15 23:18:1598init [--] [<path>...]::
Junio C Hamano3d1b5a12013-05-17 23:34:0299Initialize the submodules recorded in the index (which were
Junio C Hamano53eec4d2017-03-10 23:02:36100added and committed elsewhere) by setting `submodule.$name.url`
Junio C Hamano62908fd2023-08-04 19:05:22101in `.git/config`, using the same setting from `.gitmodules` as
Junio C Hamano53eec4d2017-03-10 23:02:36102a template. If the URL is relative, it will be resolved using
103the default remote. If there is no default remote, the current
104repository will be assumed to be upstream.
105+
106Optional <path> arguments limit which submodules will be initialized.
Junio C Hamanodc8d0c32017-03-30 23:00:21107If no path is specified and submodule.active has been configured, submodules
108configured to be active will be initialized, otherwise all submodules are
109initialized.
Junio C Hamano53eec4d2017-03-10 23:02:36110+
Junio C Hamano62908fd2023-08-04 19:05:22111It will also copy the value of `submodule.$name.update`, if present in
112the `.gitmodules` file, to `.git/config`, but (1) this command does not
113alter existing information in `.git/config`, and (2) `submodule.$name.update`
114that is set to a custom command is *not* copied for security reasons.
115+
116You can then customize the submodule clone URLs in `.git/config`
Junio C Hamano53eec4d2017-03-10 23:02:36117for your local setup and proceed to `git submodule update`;
118you can also just use `git submodule update --init` without
119the explicit 'init' step if you do not intend to customize
120any submodule locations.
121+
Junio C Hamano967cda72017-06-30 21:49:53122See the add subcommand for the definition of default remote.
Junio C Hamano38b693c2007-06-03 08:40:14123
Junio C Hamanoe89102f2017-02-15 23:18:15124deinit [-f|--force] (--all|[--] <path>...)::
Junio C Hamano240dc3f2013-03-25 23:37:03125Unregister the given submodules, i.e. remove the whole
126`submodule.$name` section from .git/config together with their work
127tree. Further calls to `git submodule update`, `git submodule foreach`
128and `git submodule sync` will skip any unregistered submodules until
129they are initialized again, so use this command if you don't want to
Junio C Hamano387ce232017-07-12 23:01:13130have a local checkout of the submodule in your working tree anymore.
Junio C Hamano240dc3f2013-03-25 23:37:03131+
Junio C Hamano198b1f12016-05-17 22:27:24132When the command is run without pathspec, it errors out,
133instead of deinit-ing everything, to prevent mistakes.
134+
135If `--force` is specified, the submodule's working tree will
136be removed even if it contains local modifications.
Junio C Hamano387ce232017-07-12 23:01:13137+
138If you really want to remove a submodule from the repository and commit
139that use linkgit:git-rm[1] instead. See linkgit:gitsubmodules[7] for removal
140options.
Junio C Hamano240dc3f2013-03-25 23:37:03141
Junio C Hamanocd639fa2024-08-16 17:29:58142update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference <repository>] [--ref-format <format>] [--depth <depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter <filter-spec>] [--] [<path>...]::
Junio C Hamano0f7b5a92008-05-17 06:12:23143+
Junio C Hamano6bf68cf2015-03-06 23:46:29144--
145Update the registered submodules to match what the superproject
Junio C Hamanob3f862c2019-12-05 22:22:00146expects by cloning missing submodules, fetching missing commits
147in submodules and updating the working tree of
Junio C Hamano6bf68cf2015-03-06 23:46:29148the submodules. The "updating" can be done in several ways depending
149on command line options and the value of `submodule.<name>.update`
Junio C Hamanoe89102f2017-02-15 23:18:15150configuration variable. The command line option takes precedence over
Junio C Hamano640779d2018-02-14 01:29:14151the configuration variable. If neither is given, a 'checkout' is performed.
Junio C Hamano62908fd2023-08-04 19:05:22152(note: what is in `.gitmodules` file is irrelevant at this point;
153see `git submodule init` above for how `.gitmodules` is used).
Junio C Hamano640779d2018-02-14 01:29:14154The 'update' procedures supported both from the command line as well as
155through the `submodule.<name>.update` configuration are:
Junio C Hamano6bf68cf2015-03-06 23:46:29156
157checkout;; the commit recorded in the superproject will be
Junio C Hamanoe89102f2017-02-15 23:18:15158 checked out in the submodule on a detached HEAD.
Junio C Hamano6bf68cf2015-03-06 23:46:29159+
160If `--force` is specified, the submodule will be checked out (using
Junio C Hamano640779d2018-02-14 01:29:14161`git checkout --force`), even if the commit specified
Junio C Hamano6bf68cf2015-03-06 23:46:29162in the index of the containing repository already matches the commit
163checked out in the submodule.
164
165rebase;; the current branch of the submodule will be rebased
Junio C Hamanoe89102f2017-02-15 23:18:15166 onto the commit recorded in the superproject.
Junio C Hamano6bf68cf2015-03-06 23:46:29167
168merge;; the commit recorded in the superproject will be merged
Junio C Hamanoe89102f2017-02-15 23:18:15169 into the current branch in the submodule.
170
Junio C Hamano62908fd2023-08-04 19:05:22171The following update procedures have additional limitations:
Junio C Hamano6bf68cf2015-03-06 23:46:29172
Junio C Hamano62908fd2023-08-04 19:05:22173custom command;; mechanism for running arbitrary commands with the
174 commit ID as an argument. Specifically, if the
175 `submodule.<name>.update` configuration variable is set to
176 `!custom command`, the object name of the commit recorded in the
177 superproject for the submodule is appended to the `custom command`
178 string and executed. Note that this mechanism is not supported in
179 the `.gitmodules` file or on the command line.
Junio C Hamano6bf68cf2015-03-06 23:46:29180
Junio C Hamano62908fd2023-08-04 19:05:22181none;; the submodule is not updated. This update procedure is not
182 allowed on the command line.
Junio C Hamano6bf68cf2015-03-06 23:46:29183
Junio C Hamano0f7b5a92008-05-17 06:12:23184If the submodule is not yet initialized, and you just want to use the
Junio C Hamano967cda72017-06-30 21:49:53185setting as stored in `.gitmodules`, you can automatically initialize the
Junio C Hamanoe1296e92011-08-08 22:58:15186submodule with the `--init` option.
Junio C Hamano6bf68cf2015-03-06 23:46:29187
Junio C Hamanoe1296e92011-08-08 22:58:15188If `--recursive` is specified, this command will recurse into the
Junio C Hamano0e066b92009-08-28 01:08:41189registered submodules, and update any nested submodules within.
Junio C Hamano5f907e92022-02-26 00:21:27190
Junio C Hamanocd639fa2024-08-16 17:29:58191If `--ref-format <format>` is specified, the ref storage format of newly
192cloned submodules will be set accordingly.
193
Junio C Hamano6546a502024-02-08 23:48:36194If `--filter <filter-spec>` is specified, the given partial clone filter will be
Junio C Hamano5f907e92022-02-26 00:21:27195applied to the submodule. See linkgit:git-rev-list[1] for details on filter
196specifications.
Junio C Hamano6bf68cf2015-03-06 23:46:29197--
Junio C Hamano48cd3f12019-10-09 05:55:30198set-branch (-b|--branch) <branch> [--] <path>::
199set-branch (-d|--default) [--] <path>::
Junio C Hamano2ba14712019-04-25 10:12:27200Sets the default remote tracking branch for the submodule. The
201`--branch` option allows the remote branch to be specified. The
202`--default` option removes the submodule.<name>.branch configuration
Junio C Hamanoa8911782020-07-07 05:35:57203key, which causes the tracking branch to default to the remote 'HEAD'.
Junio C Hamano2ba14712019-04-25 10:12:27204
Junio C Hamanob4896852019-12-10 23:15:09205set-url [--] <path> <newurl>::
206Sets the URL of the specified submodule to <newurl>. Then, it will
207automatically synchronize the submodule's new remote URL
208configuration.
209
Junio C Hamanoe89102f2017-02-15 23:18:15210summary [--cached|--files] [(-n|--summary-limit) <n>] [commit] [--] [<path>...]::
Junio C Hamano8b588d52008-03-15 09:48:37211Show commit summary between the given commit (defaults to HEAD) and
212working tree/index. For a submodule in question, a series of commits
213in the submodule between the given super project commit and the
Junio C Hamanoe1296e92011-08-08 22:58:15214index or working tree (switched by `--cached`) are shown. If the option
215`--files` is given, show the series of commits in the submodule between
Junio C Hamanoc276ec72009-08-26 01:35:22216the index of the super project and the working tree of the submodule
Junio C Hamanoe1296e92011-08-08 22:58:15217(this option doesn't allow to use the `--cached` option or to provide an
Junio C Hamanoc276ec72009-08-26 01:35:22218explicit commit).
Junio C Hamanoe1296e92011-08-08 22:58:15219+
220Using the `--submodule=log` option with linkgit:git-diff[1] will provide that
221information too.
Junio C Hamano38b693c2007-06-03 08:40:14222
Junio C Hamanoe89102f2017-02-15 23:18:15223foreach [--recursive] <command>::
Junio C Hamano3f2f6e52008-08-21 10:34:22224Evaluates an arbitrary shell command in each checked out submodule.
Junio C Hamanoec40f132018-06-28 21:40:57225The command has access to the variables $name, $sm_path, $displaypath,
226$sha1 and $toplevel:
Junio C Hamano967cda72017-06-30 21:49:53227$name is the name of the relevant submodule section in `.gitmodules`,
Junio C Hamanoec40f132018-06-28 21:40:57228$sm_path is the path of the submodule as recorded in the immediate
229superproject, $displaypath contains the relative path from the
230current working directory to the submodules root directory,
231$sha1 is the commit as recorded in the immediate
232superproject, and $toplevel is the absolute path to the top-level
233of the immediate superproject.
234Note that to avoid conflicts with '$PATH' on Windows, the '$path'
235variable is now a deprecated synonym of '$sm_path' variable.
Junio C Hamano3f2f6e52008-08-21 10:34:22236Any submodules defined in the superproject but not checked out are
Junio C Hamanoe1296e92011-08-08 22:58:15237ignored by this command. Unless given `--quiet`, foreach prints the name
Junio C Hamano3f2f6e52008-08-21 10:34:22238of each submodule before evaluating the command.
Junio C Hamanoe1296e92011-08-08 22:58:15239If `--recursive` is given, submodules are traversed recursively (i.e.
Junio C Hamano0e066b92009-08-28 01:08:41240the given shell command is evaluated in nested submodules as well).
Junio C Hamano3f2f6e52008-08-21 10:34:22241A non-zero return from the command in any submodule causes
242the processing to terminate. This can be overridden by adding '|| :'
243to the end of the command.
244+
Junio C Hamanoe89102f2017-02-15 23:18:15245As an example, the command below will show the path and currently
246checked out commit for each submodule:
247+
248--------------
Junio C Hamanob7e497f2020-02-12 21:41:37249git submodule foreach 'echo $sm_path `git rev-parse HEAD`'
Junio C Hamanoe89102f2017-02-15 23:18:15250--------------
Junio C Hamano3f2f6e52008-08-21 10:34:22251
Junio C Hamanoe89102f2017-02-15 23:18:15252sync [--recursive] [--] [<path>...]::
Junio C Hamanof9e04eb2008-08-28 02:50:50253Synchronizes submodules' remote URL configuration setting
Junio C Hamano967cda72017-06-30 21:49:53254to the value specified in `.gitmodules`. It will only affect those
Junio C Hamano0ff98162012-03-31 18:19:09255submodules which already have a URL entry in .git/config (that is the
Junio C Hamano708376e2011-07-19 20:02:13256case when they are initialized or freshly added). This is useful when
Junio C Hamanof9e04eb2008-08-28 02:50:50257submodule URLs change upstream and you need to update your local
258repositories accordingly.
259+
Junio C Hamanoccb82522018-05-08 07:52:09260`git submodule sync` synchronizes all submodules while
261`git submodule sync -- A` synchronizes submodule "A" only.
Junio C Hamano45b356c2015-12-11 21:31:17262+
263If `--recursive` is specified, this command will recurse into the
264registered submodules, and sync any nested submodules within.
Junio C Hamano3f2f6e52008-08-21 10:34:22265
Junio C Hamano56ace3d2017-01-10 23:43:41266absorbgitdirs::
267If a git directory of a submodule is inside the submodule,
Junio C Hamano9d828c92020-01-08 21:18:22268move the git directory of the submodule into its superproject's
Junio C Hamano56ace3d2017-01-10 23:43:41269`$GIT_DIR/modules` path and then connect the git directory and
270its working directory by setting the `core.worktree` and adding
271a .git file pointing to the git directory embedded in the
272superprojects git directory.
273+
274A repository that was cloned independently and later added as a submodule or
275old setups have the submodules git directory inside the submodule instead of
276embedded into the superprojects git directory.
277+
278This command is recursive by default.
279
Junio C Hamano38b693c2007-06-03 08:40:14280OPTIONS
281-------
Junio C Hamanoeb415992008-06-08 22:49:47282-q::
283--quiet::
Junio C Hamano38b693c2007-06-03 08:40:14284Only print error messages.
285
Junio C Hamano309465b2018-05-30 06:32:59286--progress::
287This option is only valid for add and update commands.
288Progress status is reported on the standard error stream
289by default when it is attached to a terminal, unless -q
290is specified. This flag forces progress status even if the
291standard error stream is not directed to a terminal.
292
Junio C Hamano198b1f12016-05-17 22:27:24293--all::
294This option is only valid for the deinit command. Unregister all
295submodules in the working tree.
296
Junio C Hamano2ba14712019-04-25 10:12:27297-b <branch>::
298--branch <branch>::
Junio C Hamano1d90cb02007-07-03 07:05:31299Branch of repository to add as submodule.
Junio C Hamano52b6ba32014-04-01 00:26:48300The name of the branch is recorded as `submodule.<name>.branch` in
Junio C Hamano4a401d52016-10-26 22:24:37301`.gitmodules` for `update --remote`. A special value of `.` is used to
302indicate that the name of the branch in the submodule should be the
Junio C Hamano2ba14712019-04-25 10:12:27303same name as the current branch in the current repository. If the
Junio C Hamanoa8911782020-07-07 05:35:57304option is not specified, it defaults to the remote 'HEAD'.
Junio C Hamano1d90cb02007-07-03 07:05:31305
Junio C Hamanoafabd322010-07-19 20:26:15306-f::
307--force::
Junio C Hamano240dc3f2013-03-25 23:37:03308This option is only valid for add, deinit and update commands.
Junio C Hamano60033462011-05-03 00:48:43309When running add, allow adding an otherwise ignored submodule path.
Junio C Hamano198b1f12016-05-17 22:27:24310When running deinit the submodule working trees will be removed even
311if they contain local changes.
Junio C Hamano6bf68cf2015-03-06 23:46:29312When running update (only effective with the checkout procedure),
313throw away local changes in submodules when switching to a
314different commit; and always run a checkout operation in the
315submodule, even if the commit listed in the index of the
316containing repository matches the commit checked out in the
317submodule.
Junio C Hamanoafabd322010-07-19 20:26:15318
Junio C Hamano38b693c2007-06-03 08:40:14319--cached::
Junio C Hamano8b588d52008-03-15 09:48:37320This option is only valid for status and summary commands. These
321commands typically use the commit found in the submodule HEAD, but
322with this option, the commit stored in the index is used instead.
323
Junio C Hamanoc276ec72009-08-26 01:35:22324--files::
325This option is only valid for the summary command. This command
326compares the commit in the index with that in the submodule HEAD
327when this option is used.
328
Junio C Hamanoeb415992008-06-08 22:49:47329-n::
330--summary-limit::
Junio C Hamano8b588d52008-03-15 09:48:37331This option is only valid for the summary command.
332Limit the summary size (number of commits shown in total).
Junio C Hamano1bdd3b02008-04-13 05:33:18333Giving 0 will disable the summary; a negative number means unlimited
Junio C Hamano8b588d52008-03-15 09:48:37334(the default). This limit only applies to modified submodules. The
335size is always limited to 1 for added/deleted/typechanged submodules.
Junio C Hamano38b693c2007-06-03 08:40:14336
Junio C Hamanoabad6da2013-01-06 09:06:32337--remote::
338This option is only valid for the update command. Instead of using
339the superproject's recorded SHA-1 to update the submodule, use the
Junio C Hamano8401f142013-07-12 22:47:46340status of the submodule's remote-tracking branch. The remote used
Junio C Hamanoabad6da2013-01-06 09:06:32341is branch's remote (`branch.<name>.remote`), defaulting to `origin`.
Junio C Hamanoa8911782020-07-07 05:35:57342The remote branch used defaults to the remote `HEAD`, but the branch
343name may be overridden by setting the `submodule.<name>.branch`
344option in either `.gitmodules` or `.git/config` (with `.git/config`
345taking precedence).
Junio C Hamanoabad6da2013-01-06 09:06:32346+
347This works for any of the supported update procedures (`--checkout`,
348`--rebase`, etc.). The only change is the source of the target SHA-1.
349For example, `submodule update --remote --merge` will merge upstream
350submodule changes into the submodules, while `submodule update
351--merge` will merge superproject gitlink changes into the submodules.
352+
353In order to ensure a current tracking branch state, `update --remote`
354fetches the submodule's remote repository before calculating the
355SHA-1. If you don't want to fetch, you should use `submodule update
356--remote --no-fetch`.
Junio C Hamano5b3533d2014-02-27 23:07:15357+
358Use this option to integrate changes from the upstream subproject with
359your submodule's current HEAD. Alternatively, you can run `git pull`
360from the submodule, which is equivalent except for the remote branch
361name: `update --remote` uses the default upstream repository and
362`submodule.<name>.branch`, while `git pull` uses the submodule's
363`branch.<name>.merge`. Prefer `submodule.<name>.branch` if you want
364to distribute the default upstream branch with the superproject and
365`branch.<name>.merge` if you want a more native feel while working in
366the submodule itself.
Junio C Hamanoabad6da2013-01-06 09:06:32367
Junio C Hamano8bc410e2009-02-15 10:38:19368-N::
369--no-fetch::
370This option is only valid for the update command.
371Don't fetch new objects from the remote site.
372
Junio C Hamano81703b22014-03-14 22:00:27373--checkout::
374This option is only valid for the update command.
375Checkout the commit recorded in the superproject on a detached HEAD
376in the submodule. This is the default behavior, the main use of
377this option is to override `submodule.$name.update` when set to
Junio C Hamano6bf68cf2015-03-06 23:46:29378a value other than `checkout`.
Junio C Hamano81703b22014-03-14 22:00:27379If the key `submodule.$name.update` is either not explicitly set or
380set to `checkout`, this option is implicit.
381
Junio C Hamano0e88f3e2009-06-21 08:03:25382--merge::
383This option is only valid for the update command.
384Merge the commit recorded in the superproject into the current branch
385of the submodule. If this option is given, the submodule's HEAD will
386not be detached. If a merge failure prevents this process, you will
387have to resolve the resulting conflicts within the submodule with the
388usual conflict resolution tools.
389If the key `submodule.$name.update` is set to `merge`, this option is
390implicit.
391
Junio C Hamano25e7ba62009-06-14 01:03:22392--rebase::
393This option is only valid for the update command.
394Rebase the current branch onto the commit recorded in the
395superproject. If this option is given, the submodule's HEAD will not
Junio C Hamano167b1382010-01-31 23:04:31396be detached. If a merge failure prevents this process, you will have
Junio C Hamano25e7ba62009-06-14 01:03:22397to resolve these failures with linkgit:git-rebase[1].
398If the key `submodule.$name.update` is set to `rebase`, this option is
399implicit.
400
Junio C Hamanoe1296e92011-08-08 22:58:15401--init::
402This option is only valid for the update command.
403Initialize all submodules for which "git submodule init" has not been
404called so far before updating.
405
Junio C Hamanoa1295452012-11-13 22:32:04406--name::
407This option is only valid for the add command. It sets the submodule's
408name to the given string instead of defaulting to its path. The name
409must be valid as a directory name and may not end with a '/'.
410
Junio C Hamano7ae18252009-05-23 09:53:32411--reference <repository>::
412This option is only valid for add and update commands. These
413commands sometimes need to clone a remote repository. In this case,
414this option will be passed to the linkgit:git-clone[1] command.
415+
416*NOTE*: Do *not* use this option unless you have read the note
Junio C Hamano309465b2018-05-30 06:32:59417for linkgit:git-clone[1]'s `--reference`, `--shared`, and `--dissociate`
418options carefully.
419
420--dissociate::
421This option is only valid for add and update commands. These
422commands sometimes need to clone a remote repository. In this case,
423this option will be passed to the linkgit:git-clone[1] command.
424+
425*NOTE*: see the NOTE for the `--reference` option.
Junio C Hamano7ae18252009-05-23 09:53:32426
Junio C Hamano0e066b92009-08-28 01:08:41427--recursive::
Junio C Hamano45b356c2015-12-11 21:31:17428This option is only valid for foreach, update, status and sync commands.
Junio C Hamano0e066b92009-08-28 01:08:41429Traverse submodules recursively. The operation is performed not
430only in the submodules of the current repo, but also
431in any nested submodules inside those submodules (and so on).
432
Junio C Hamanoededf2b2013-07-15 21:11:16433--depth::
434This option is valid for add and update commands. Create a 'shallow'
435clone with a history truncated to the specified number of revisions.
436See linkgit:git-clone[1]
437
Junio C Hamanofedb1b42016-06-20 21:23:40438--[no-]recommend-shallow::
439This option is only valid for the update command.
440The initial clone of a submodule will use the recommended
Junio C Hamano967cda72017-06-30 21:49:53441`submodule.<name>.shallow` as provided by the `.gitmodules` file
Junio C Hamanofedb1b42016-06-20 21:23:40442by default. To ignore the suggestions use `--no-recommend-shallow`.
443
Junio C Hamanobec5da42016-04-06 22:58:21444-j <n>::
445--jobs <n>::
446This option is only valid for the update command.
447Clone new submodules in parallel with as many jobs.
448Defaults to the `submodule.fetchJobs` option.
Junio C Hamanoededf2b2013-07-15 21:11:16449
Junio C Hamanob082a532020-03-05 21:52:25450--[no-]single-branch::
451This option is only valid for the update command.
452Clone only one branch during update: HEAD or one specified by --branch.
453
Junio C Hamano9e395072008-07-31 22:11:21454<path>...::
455Paths to submodule(s). When specified this will restrict the command
Junio C Hamano38b693c2007-06-03 08:40:14456to only operate on the submodules found at the specified paths.
Junio C Hamano38ddcce2008-07-15 15:49:03457(This argument is required with add).
Junio C Hamano38b693c2007-06-03 08:40:14458
459FILES
460-----
Junio C Hamano967cda72017-06-30 21:49:53461When initializing submodules, a `.gitmodules` file in the top-level directory
Junio C Hamano38b693c2007-06-03 08:40:14462of the containing repository is used to find the url of each submodule.
Junio C Hamano91baf102007-12-31 09:44:26463This file should be formatted in the same way as `$GIT_DIR/config`. The key
Junio C Hamano35738e82008-01-07 07:55:46464to each submodule url is "submodule.$name.url". See linkgit:gitmodules[5]
Junio C Hamanoe66c6c02007-12-17 08:26:13465for details.
Junio C Hamano38b693c2007-06-03 08:40:14466
Junio C Hamano387ce232017-07-12 23:01:13467SEE ALSO
468--------
469linkgit:gitsubmodules[7], linkgit:gitmodules[5].
470
Junio C Hamano38b693c2007-06-03 08:40:14471GIT
472---
Junio C Hamanof7c042d2008-06-06 22:50:53473Part of the linkgit:git[1] suite