1GITMODULES(5) Git Manual GITMODULES(5)
2
3
4
6 gitmodules - Defining submodule properties
7
9 $GIT_WORK_TREE/.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 the 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 the
48 remote HEAD. A special value of . is used to indicate that the
49 name of the branch in the submodule should be the same name as the
50 current branch in the current repository. See the --remote
51 documentation in git-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 submodule’s 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 submodule’s 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 Git does not allow the .gitmodules file within a working tree to be a
99 symbolic link, and will refuse to check out such a tree entry. This
100 keeps behavior consistent when the file is accessed from the index or a
101 tree versus from the filesystem, and helps Git reliably enforce
102 security checks of the file contents.
103
105 Consider the following .gitmodules file:
106
107 [submodule "libfoo"]
108 path = include/foo
109 url = git://foo.com/git/lib.git
110
111 [submodule "libbar"]
112 path = include/bar
113 url = git://bar.com/git/lib.git
114
115 This defines two submodules, libfoo and libbar. These are expected to
116 be checked out in the paths include/foo and include/bar, and for both
117 submodules a URL is specified which can be used for cloning the
118 submodules.
119
121 git-submodule(1), gitsubmodules(7), git-config(1)
122
124 Part of the git(1) suite
125
126
127
128Git 2.36.1 2022-05-05 GITMODULES(5)