blob: 539b4e1997e62c741ba4cd68ab28fcab534380ec [file] [log] [blame]
Junio C Hamano6926bef2007-06-16 09:54:051gitmodules(5)
2=============
3
4NAME
5----
Junio C Hamanoc9cb5172018-06-01 07:13:446gitmodules - Defining submodule properties
Junio C Hamano6926bef2007-06-16 09:54:057
8SYNOPSIS
9--------
Junio C Hamano17bd2272008-09-01 06:11:1710$GIT_WORK_DIR/.gitmodules
Junio C Hamano6926bef2007-06-16 09:54:0511
12
13DESCRIPTION
14-----------
15
Junio C Hamano076ffcc2013-02-06 05:13:2116The `.gitmodules` file, located in the top-level directory of a Git
Junio C Hamano6926bef2007-06-16 09:54:0517working tree, is a text file with a syntax matching the requirements
Junio C Hamano35738e82008-01-07 07:55:4618of linkgit:git-config[1].
Junio C Hamano6926bef2007-06-16 09:54:0519
20The file contains one subsection per submodule, and the subsection value
Junio C Hamanoa1295452012-11-13 22:32:0421is the name of the submodule. The name is set to the path where the
Junio C Hamano92d80372016-07-13 22:00:0522submodule has been added unless it was customized with the `--name`
Junio C Hamanoa1295452012-11-13 22:32:0423option of 'git submodule add'. Each submodule section also contains the
Junio C Hamano6926bef2007-06-16 09:54:0524following required keys:
25
26submodule.<name>.path::
Junio C Hamano076ffcc2013-02-06 05:13:2127Defines the path, relative to the top-level directory of the Git
Junio C Hamano6926bef2007-06-16 09:54:0528working tree, where the submodule is expected to be checked out.
29The path name must not end with a `/`. All submodule paths must
30be unique within the .gitmodules file.
31
32submodule.<name>.url::
Junio C Hamano0ff98162012-03-31 18:19:0933Defines a URL from which the submodule repository can be cloned.
Junio C Hamano78e3a782010-07-15 22:24:4534This may be either an absolute URL ready to be passed to
35linkgit:git-clone[1] or (if it begins with ./ or ../) a location
36relative to the superproject's origin repository.
Junio C Hamano6926bef2007-06-16 09:54:0537
Junio C Hamano9906f1f2014-01-06 22:24:1738In addition, there are a number of optional keys:
39
Junio C Hamano25e7ba62009-06-14 01:03:2240submodule.<name>.update::
Junio C Hamano6bf68cf2015-03-06 23:46:2941Defines the default update procedure for the named submodule,
42i.e. how the submodule is updated by "git submodule update"
43command in the superproject. This is only used by `git
44submodule init` to initialize the configuration variable of
45the same name. Allowed values here are 'checkout', 'rebase',
46'merge' or 'none'. See description of 'update' command in
Junio C Hamano59e88242019-12-10 14:09:0447linkgit:git-submodule[1] for their meaning. For security
48reasons, the '!command' form is not accepted here.
Junio C Hamano25e7ba62009-06-14 01:03:2249
Junio C Hamanoabad6da2013-01-06 09:06:3250submodule.<name>.branch::
51A remote branch name for tracking updates in the upstream submodule.
Junio C Hamanoa8911782020-07-07 05:35:5752If the option is not specified, it defaults to the remote 'HEAD'.
53A special value of `.` is used to indicate that the name of the branch
54in the submodule should be the same name as the current branch in the
Junio C Hamano4a401d52016-10-26 22:24:3755current repository. See the `--remote` documentation in
56linkgit:git-submodule[1] for details.
Junio C Hamanoabad6da2013-01-06 09:06:3257
Junio C Hamano0d75e872010-12-17 06:57:2658submodule.<name>.fetchRecurseSubmodules::
Junio C Hamano5cd15182011-04-05 00:21:1059This option can be used to control recursive fetching of this
Junio C Hamano0d75e872010-12-17 06:57:2660submodule. If this option is also present in the submodules entry in
61.git/config of the superproject, the setting there will override the
62one found in .gitmodules.
Junio C Hamano7165bf72011-01-04 22:06:1863Both settings can be overridden on the command line by using the
Junio C Hamano5cd15182011-04-05 00:21:1064"--[no-]recurse-submodules" option to "git fetch" and "git pull".
Junio C Hamano0d75e872010-12-17 06:57:2665
Junio C Hamano619596a2010-08-18 22:15:3566submodule.<name>.ignore::
67Defines under what circumstances "git status" and the diff family show
Junio C Hamanobeca3402017-04-27 02:21:5168a submodule as modified. The following values are supported:
Junio C Hamano94d00a52018-10-30 07:34:4069+
70--
Junio C Hamanobeca3402017-04-27 02:21:5171all;; The submodule will never be considered modified (but will
72 nonetheless show up in the output of status and commit when it has
73 been staged).
74
75dirty;; All changes to the submodule's work tree will be ignored, only
76 committed differences between the HEAD of the submodule and its
77 recorded state in the superproject are taken into account.
78
79untracked;; Only untracked files in submodules will be ignored.
80 Committed differences and modifications to tracked files will show
81 up.
82
Junio C Hamano8ef91f32019-12-01 22:58:2783none;; No modifications to submodules are ignored, all of committed
Junio C Hamanobeca3402017-04-27 02:21:5184 differences, and modifications to tracked and untracked files are
85 shown. This is the default option.
86
Junio C Hamano94d00a52018-10-30 07:34:4087If this option is also present in the submodules entry in .git/config
88of the superproject, the setting there will override the one found in
89.gitmodules.
90
91Both settings can be overridden on the command line by using the
Junio C Hamano48cd3f12019-10-09 05:55:3092"--ignore-submodules" option. The 'git submodule' commands are not
Junio C Hamano94d00a52018-10-30 07:34:4093affected by this setting.
94--
Junio C Hamano619596a2010-08-18 22:15:3595
Junio C Hamanoe548d1b2016-08-08 22:26:4996submodule.<name>.shallow::
97When set to true, a clone of this submodule will be performed as a
Junio C Hamanobeca3402017-04-27 02:21:5198shallow clone (with a history depth of 1) unless the user explicitly
99asks for a non-shallow clone.
Junio C Hamanoe548d1b2016-08-08 22:26:49100
Junio C Hamano6926bef2007-06-16 09:54:05101
102EXAMPLES
103--------
104
105Consider the following .gitmodules file:
106
Junio C Hamano48cd3f12019-10-09 05:55:30107----
108[submodule "libfoo"]
109path = include/foo
110url = git://foo.com/git/lib.git
Junio C Hamano6926bef2007-06-16 09:54:05111
Junio C Hamano48cd3f12019-10-09 05:55:30112[submodule "libbar"]
113path = include/bar
114url = git://bar.com/git/lib.git
115----
Junio C Hamano6926bef2007-06-16 09:54:05116
117This defines two submodules, `libfoo` and `libbar`. These are expected to
Junio C Hamanob5513772019-04-22 03:38:39118be checked out in the paths `include/foo` and `include/bar`, and for both
Junio C Hamano0ff98162012-03-31 18:19:09119submodules a URL is specified which can be used for cloning the submodules.
Junio C Hamano6926bef2007-06-16 09:54:05120
121SEE ALSO
122--------
Junio C Hamano2f5a9892019-12-25 21:12:55123linkgit:git-submodule[1], linkgit:gitsubmodules[7], linkgit:git-config[1]
Junio C Hamano6926bef2007-06-16 09:54:05124
Junio C Hamano6926bef2007-06-16 09:54:05125GIT
126---
Junio C Hamanof7c042d2008-06-06 22:50:53127Part of the linkgit:git[1] suite