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. For security
43 reasons, the !command form is not accepted here.
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 modifications 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
85 .git/config of the superproject, the setting there will override
86 the one found in .gitmodules.
87
88 Both settings can be overridden on the command line by using the
89 "--ignore-submodules" option. The git submodule commands are not
90 affected by this setting.
91
92 submodule.<name>.shallow
93 When set to true, a clone of this submodule will be performed as a
94 shallow clone (with a history depth of 1) unless the user
95 explicitly asks for a non-shallow clone.
96
98 Consider the following .gitmodules file:
99
100 [submodule "libfoo"]
101 path = include/foo
102 url = git://foo.com/git/lib.git
103
104 [submodule "libbar"]
105 path = include/bar
106 url = git://bar.com/git/lib.git
107
108 This defines two submodules, libfoo and libbar. These are expected to
109 be checked out in the paths include/foo and include/bar, and for both
110 submodules a URL is specified which can be used for cloning the
111 submodules.
112
114 git-submodule(1), gitsubmodules(7), git-config(1)
115
117 Part of the git(1) suite
118
119
120
121Git 2.26.2 2020-04-20 GITMODULES(5)