blob: db5d47eb19b8f2aa21c11a9d3eedf40b9d71e84e [file] [log] [blame]
Junio C Hamano6926bef2007-06-16 09:54:051gitmodules(5)
2=============
3
4NAME
5----
6gitmodules - defining submodule properties
7
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
47linkgit:git-submodule[1] for their meaning. Note that the
48'!command' form is intentionally ignored here for security
49reasons.
Junio C Hamano25e7ba62009-06-14 01:03:2250
Junio C Hamanoabad6da2013-01-06 09:06:3251submodule.<name>.branch::
52A remote branch name for tracking updates in the upstream submodule.
Junio C Hamano4a401d52016-10-26 22:24:3753If the option is not specified, it defaults to 'master'. A special
54value of `.` is used to indicate that the name of the branch in the
55submodule should be the same name as the current branch in the
56current repository. See the `--remote` documentation in
57linkgit:git-submodule[1] for details.
Junio C Hamanoabad6da2013-01-06 09:06:3258
Junio C Hamano0d75e872010-12-17 06:57:2659submodule.<name>.fetchRecurseSubmodules::
Junio C Hamano5cd15182011-04-05 00:21:1060This option can be used to control recursive fetching of this
Junio C Hamano0d75e872010-12-17 06:57:2661submodule. If this option is also present in the submodules entry in
62.git/config of the superproject, the setting there will override the
63one found in .gitmodules.
Junio C Hamano7165bf72011-01-04 22:06:1864Both settings can be overridden on the command line by using the
Junio C Hamano5cd15182011-04-05 00:21:1065"--[no-]recurse-submodules" option to "git fetch" and "git pull".
Junio C Hamano0d75e872010-12-17 06:57:2666
Junio C Hamano619596a2010-08-18 22:15:3567submodule.<name>.ignore::
68Defines under what circumstances "git status" and the diff family show
Junio C Hamanobeca3402017-04-27 02:21:5169a submodule as modified. The following values are supported:
70
71all;; 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
83none;; No modifiations to submodules are ignored, all of committed
84 differences, and modifications to tracked and untracked files are
85 shown. This is the default option.
86
87If this option is also present in the submodules entry in .git/config
88of the superproject, the setting there will override the one found in
Junio C Hamano619596a2010-08-18 22:15:3589.gitmodules.
Junio C Hamanode9745c2010-08-23 17:10:1890Both settings can be overridden on the command line by using the
Junio C Hamano369e3402013-10-15 18:40:2591"--ignore-submodule" option. The 'git submodule' commands are not
92affected by this setting.
Junio C Hamano619596a2010-08-18 22:15:3593
Junio C Hamanoe548d1b2016-08-08 22:26:4994submodule.<name>.shallow::
95When set to true, a clone of this submodule will be performed as a
Junio C Hamanobeca3402017-04-27 02:21:5196shallow clone (with a history depth of 1) unless the user explicitly
97asks for a non-shallow clone.
Junio C Hamanoe548d1b2016-08-08 22:26:4998
Junio C Hamano6926bef2007-06-16 09:54:0599
100EXAMPLES
101--------
102
103Consider the following .gitmodules file:
104
105[submodule "libfoo"]
106path = include/foo
107url = git://foo.com/git/lib.git
108
109[submodule "libbar"]
110path = include/bar
111url = git://bar.com/git/lib.git
112
113
114This defines two submodules, `libfoo` and `libbar`. These are expected to
115be checked out in the paths 'include/foo' and 'include/bar', and for both
Junio C Hamano0ff98162012-03-31 18:19:09116submodules a URL is specified which can be used for cloning the submodules.
Junio C Hamano6926bef2007-06-16 09:54:05117
118SEE ALSO
119--------
Junio C Hamano35738e82008-01-07 07:55:46120linkgit:git-submodule[1] linkgit:git-config[1]
Junio C Hamano6926bef2007-06-16 09:54:05121
Junio C Hamano6926bef2007-06-16 09:54:05122GIT
123---
Junio C Hamanof7c042d2008-06-06 22:50:53124Part of the linkgit:git[1] suite