1GITMODULES(5) Git Manual GITMODULES(5)
2
3
4
6 gitmodules - Defining submodule properties
7
9 $GIT_WORK_DIR/.gitmodules
10
12 The .gitmodules file, located in the top-level directory of a Git
13 working tree, is a text file with a syntax matching the requirements of
14 git-config(1).
15
16 The file contains one subsection per submodule, and the subsection
17 value is the name of the submodule. The name is set to the path where
18 the submodule has been added unless it was customized with the --name
19 option of git submodule add. Each submodule section also contains the
20 following required keys:
21
22 submodule.<name>.path
23 Defines the path, relative to the top-level directory of the Git
24 working tree, where the submodule is expected to be checked out.
25 The path name must not end with a /. All submodule paths must be
26 unique within the .gitmodules file.
27
28 submodule.<name>.url
29 Defines a URL from which the submodule repository can be cloned.
30 This may be either an absolute URL ready to be passed to git-
31 clone(1) or (if it begins with ./ or ../) a location relative to
32 the superproject’s origin repository.
33
34 In addition, there are a number of optional keys:
35
36 submodule.<name>.update
37 Defines the default update procedure for the named submodule, i.e.
38 how the submodule is updated by "git submodule update" command in
39 the superproject. This is only used by git submodule init to
40 initialize the configuration variable of the same name. Allowed
41 values here are checkout, rebase, merge or none. See description of
42 update command in git-submodule(1) for their meaning. Note that the
43 !command form is intentionally ignored here for security reasons.
44
45 submodule.<name>.branch
46 A remote branch name for tracking updates in the upstream
47 submodule. If the option is not specified, it defaults to master. A
48 special value of . is used to indicate that the name of the branch
49 in the submodule should be the same name as the current branch in
50 the current repository. See the --remote documentation in git-
51 submodule(1) for details.
52
53 submodule.<name>.fetchRecurseSubmodules
54 This option can be used to control recursive fetching of this
55 submodule. If this option is also present in the submodules entry
56 in .git/config of the superproject, the setting there will override
57 the one found in .gitmodules. Both settings can be overridden on
58 the command line by using the "--[no-]recurse-submodules" option to
59 "git fetch" and "git pull".
60
61 submodule.<name>.ignore
62 Defines under what circumstances "git status" and the diff family
63 show a submodule as modified. The following values are supported:
64
65 all
66 The submodule will never be considered modified (but will
67 nonetheless show up in the output of status and commit when it
68 has been staged).
69
70 dirty
71 All changes to the submodule’s work tree will be ignored, only
72 committed differences between the HEAD of the submodule and its
73 recorded state in the superproject are taken into account.
74
75 untracked
76 Only untracked files in submodules will be ignored. Committed
77 differences and modifications to tracked files will show up.
78
79 none
80 No modifiations to submodules are ignored, all of committed
81 differences, and modifications to tracked and untracked files
82 are shown. This is the default option.
83
84 If this option is also present in the submodules entry in .git/config
85 of the superproject, the setting there will override the one found in
86 .gitmodules.
87 Both settings can be overridden on the command line by using the
88 "--ignore-submodule" option. The 'git submodule' commands are not
89 affected by this setting.
90
91 submodule.<name>.shallow
92 When set to true, a clone of this submodule will be performed as a
93 shallow clone (with a history depth of 1) unless the user
94 explicitly asks for a non-shallow clone.
95
97 Consider the following .gitmodules file:
98
99 [submodule "libfoo"]
100 path = include/foo
101 url = git://foo.com/git/lib.git
102
103 [submodule "libbar"]
104 path = include/bar
105 url = git://bar.com/git/lib.git
106
107 This defines two submodules, libfoo and libbar. These are expected to
108 be checked out in the paths include/foo and include/bar, and for both
109 submodules a URL is specified which can be used for cloning the
110 submodules.
111
113 git-submodule(1) git-config(1)
114
116 Part of the git(1) suite
117
118
119
120Git 2.18.1 05/14/2019 GITMODULES(5)