Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 1 | gitmodules(5) |
| 2 | ============= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | gitmodules - defining submodule properties |
| 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
Junio C Hamano | 17bd227 | 2008-09-01 06:11:17 | [diff] [blame] | 10 | $GIT_WORK_DIR/.gitmodules |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 11 | |
| 12 | |
| 13 | DESCRIPTION |
| 14 | ----------- |
| 15 | |
| 16 | The `.gitmodules` file, located in the top-level directory of a git |
| 17 | working tree, is a text file with a syntax matching the requirements |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 18 | of linkgit:git-config[1]. |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 19 | |
| 20 | The file contains one subsection per submodule, and the subsection value |
| 21 | is the name of the submodule. Each submodule section also contains the |
| 22 | following required keys: |
| 23 | |
| 24 | submodule.<name>.path:: |
| 25 | Defines the path, relative to the top-level directory of the git |
| 26 | working tree, where the submodule is expected to be checked out. |
| 27 | The path name must not end with a `/`. All submodule paths must |
| 28 | be unique within the .gitmodules file. |
| 29 | |
| 30 | submodule.<name>.url:: |
Junio C Hamano | 0ff9816 | 2012-03-31 18:19:09 | [diff] [blame] | 31 | Defines a URL from which the submodule repository can be cloned. |
Junio C Hamano | 78e3a78 | 2010-07-15 22:24:45 | [diff] [blame] | 32 | This may be either an absolute URL ready to be passed to |
| 33 | linkgit:git-clone[1] or (if it begins with ./ or ../) a location |
| 34 | relative to the superproject's origin repository. |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 35 | |
Junio C Hamano | 25e7ba6 | 2009-06-14 01:03:22 | [diff] [blame] | 36 | submodule.<name>.update:: |
| 37 | Defines what to do when the submodule is updated by the superproject. |
| 38 | If 'checkout' (the default), the new commit specified in the |
| 39 | superproject will be checked out in the submodule on a detached HEAD. |
| 40 | If 'rebase', the current branch of the submodule will be rebased onto |
Junio C Hamano | 0e88f3e | 2009-06-21 08:03:25 | [diff] [blame] | 41 | the commit specified in the superproject. If 'merge', the commit |
| 42 | specified in the superproject will be merged into the current branch |
| 43 | in the submodule. |
Junio C Hamano | 4fdb4d6 | 2012-05-11 20:03:49 | [diff] [blame^] | 44 | If 'none', the submodule with name `$name` will not be updated |
| 45 | by default. |
| 46 | |
Junio C Hamano | 25e7ba6 | 2009-06-14 01:03:22 | [diff] [blame] | 47 | This config option is overridden if 'git submodule update' is given |
Junio C Hamano | 4fdb4d6 | 2012-05-11 20:03:49 | [diff] [blame^] | 48 | the '--merge', '--rebase' or '--checkout' options. |
Junio C Hamano | 25e7ba6 | 2009-06-14 01:03:22 | [diff] [blame] | 49 | |
Junio C Hamano | 0d75e87 | 2010-12-17 06:57:26 | [diff] [blame] | 50 | submodule.<name>.fetchRecurseSubmodules:: |
Junio C Hamano | 5cd1518 | 2011-04-05 00:21:10 | [diff] [blame] | 51 | This option can be used to control recursive fetching of this |
Junio C Hamano | 0d75e87 | 2010-12-17 06:57:26 | [diff] [blame] | 52 | submodule. If this option is also present in the submodules entry in |
| 53 | .git/config of the superproject, the setting there will override the |
| 54 | one found in .gitmodules. |
Junio C Hamano | 7165bf7 | 2011-01-04 22:06:18 | [diff] [blame] | 55 | Both settings can be overridden on the command line by using the |
Junio C Hamano | 5cd1518 | 2011-04-05 00:21:10 | [diff] [blame] | 56 | "--[no-]recurse-submodules" option to "git fetch" and "git pull". |
Junio C Hamano | 0d75e87 | 2010-12-17 06:57:26 | [diff] [blame] | 57 | |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 58 | submodule.<name>.ignore:: |
| 59 | Defines under what circumstances "git status" and the diff family show |
| 60 | a submodule as modified. When set to "all", it will never be considered |
| 61 | modified, "dirty" will ignore all changes to the submodules work tree and |
| 62 | takes only differences between the HEAD of the submodule and the commit |
| 63 | recorded in the superproject into account. "untracked" will additionally |
| 64 | let submodules with modified tracked files in their work tree show up. |
| 65 | Using "none" (the default when this option is not set) also shows |
| 66 | submodules that have untracked files in their work tree as changed. |
| 67 | If this option is also present in the submodules entry in .git/config of |
| 68 | the superproject, the setting there will override the one found in |
| 69 | .gitmodules. |
Junio C Hamano | de9745c | 2010-08-23 17:10:18 | [diff] [blame] | 70 | Both settings can be overridden on the command line by using the |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 71 | "--ignore-submodule" option. |
| 72 | |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 73 | |
| 74 | EXAMPLES |
| 75 | -------- |
| 76 | |
| 77 | Consider the following .gitmodules file: |
| 78 | |
| 79 | [submodule "libfoo"] |
| 80 | path = include/foo |
| 81 | url = git://foo.com/git/lib.git |
| 82 | |
| 83 | [submodule "libbar"] |
| 84 | path = include/bar |
| 85 | url = git://bar.com/git/lib.git |
| 86 | |
| 87 | |
| 88 | This defines two submodules, `libfoo` and `libbar`. These are expected to |
| 89 | be checked out in the paths 'include/foo' and 'include/bar', and for both |
Junio C Hamano | 0ff9816 | 2012-03-31 18:19:09 | [diff] [blame] | 90 | submodules a URL is specified which can be used for cloning the submodules. |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 91 | |
| 92 | SEE ALSO |
| 93 | -------- |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 94 | linkgit:git-submodule[1] linkgit:git-config[1] |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 95 | |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 96 | GIT |
| 97 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 98 | Part of the linkgit:git[1] suite |