Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 1 | git-submodule(1) |
| 2 | ================ |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-submodule - Initialize, update or inspect submodules |
| 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Junio C Hamano | 7a4a283 | 2007-07-07 21:53:22 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | 42059e7 | 2008-01-22 08:39:14 | [diff] [blame] | 12 | 'git-submodule' [--quiet] add [-b branch] [--] <repository> [<path>] |
| 13 | 'git-submodule' [--quiet] status [--cached] [--] [<path>...] |
| 14 | 'git-submodule' [--quiet] [init|update] [--] [<path>...] |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 15 | |
| 16 | |
| 17 | COMMANDS |
| 18 | -------- |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 19 | add:: |
| 20 | Add the given repository as a submodule at the given path |
| 21 | to the changeset to be committed next. In particular, the |
| 22 | repository is cloned at the specified path, added to the |
| 23 | changeset and registered in .gitmodules. If no path is |
| 24 | specified, the path is deduced from the repository specification. |
Junio C Hamano | 4fd58d4 | 2007-09-30 00:51:14 | [diff] [blame] | 25 | If the repository url begins with ./ or ../, it is stored as |
| 26 | given but resolved as a relative path from the main project's |
| 27 | url when cloning. |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 28 | |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 29 | status:: |
| 30 | Show the status of the submodules. This will print the SHA-1 of the |
| 31 | currently checked out commit for each submodule, along with the |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 32 | submodule path and the output of linkgit:git-describe[1] for the |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 33 | SHA-1. Each SHA-1 will be prefixed with `-` if the submodule is not |
| 34 | initialized and `+` if the currently checked out submodule commit |
| 35 | does not match the SHA-1 found in the index of the containing |
| 36 | repository. This command is the default command for git-submodule. |
| 37 | |
| 38 | init:: |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 39 | Initialize the submodules, i.e. register in .git/config each submodule |
Junio C Hamano | 7a4a283 | 2007-07-07 21:53:22 | [diff] [blame] | 40 | name and url found in .gitmodules. The key used in .git/config is |
| 41 | `submodule.$name.url`. This command does not alter existing information |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 42 | in .git/config. |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 43 | |
| 44 | update:: |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 45 | Update the registered submodules, i.e. clone missing submodules and |
| 46 | checkout the commit specified in the index of the containing repository. |
| 47 | This will make the submodules HEAD be detached. |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 48 | |
| 49 | |
| 50 | OPTIONS |
| 51 | ------- |
| 52 | -q, --quiet:: |
| 53 | Only print error messages. |
| 54 | |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 55 | -b, --branch:: |
| 56 | Branch of repository to add as submodule. |
| 57 | |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 58 | --cached:: |
| 59 | Display the SHA-1 stored in the index, not the SHA-1 of the currently |
| 60 | checked out submodule commit. This option is only valid for the |
| 61 | status command. |
| 62 | |
| 63 | <path>:: |
| 64 | Path to submodule(s). When specified this will restrict the command |
| 65 | to only operate on the submodules found at the specified paths. |
| 66 | |
| 67 | FILES |
| 68 | ----- |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 69 | When initializing submodules, a .gitmodules file in the top-level directory |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 70 | of the containing repository is used to find the url of each submodule. |
Junio C Hamano | 91baf10 | 2007-12-31 09:44:26 | [diff] [blame] | 71 | This file should be formatted in the same way as `$GIT_DIR/config`. The key |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 72 | to each submodule url is "submodule.$name.url". See linkgit:gitmodules[5] |
Junio C Hamano | e66c6c0 | 2007-12-17 08:26:13 | [diff] [blame] | 73 | for details. |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 74 | |
| 75 | |
| 76 | AUTHOR |
| 77 | ------ |
| 78 | Written by Lars Hjemli <hjemli@gmail.com> |
| 79 | |
| 80 | GIT |
| 81 | --- |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 82 | Part of the linkgit:git[7] suite |