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 | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame^] | 12 | 'git submodule' [--quiet] add [-b branch] [--] <repository> [<path>] |
| 13 | 'git submodule' [--quiet] status [--cached] [--] [<path>...] |
| 14 | 'git submodule' [--quiet] init [--] [<path>...] |
| 15 | 'git submodule' [--quiet] update [--init] [--] [<path>...] |
| 16 | 'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...] |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 17 | |
| 18 | |
| 19 | COMMANDS |
| 20 | -------- |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 21 | add:: |
| 22 | Add the given repository as a submodule at the given path |
Junio C Hamano | bb34317 | 2008-03-09 10:39:09 | [diff] [blame] | 23 | to the changeset to be committed next. If path is a valid |
| 24 | repository within the project, it is added as is. Otherwise, |
| 25 | repository is cloned at the specified path. path is added to the |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 26 | changeset and registered in .gitmodules. If no path is |
| 27 | specified, the path is deduced from the repository specification. |
Junio C Hamano | 4fd58d4 | 2007-09-30 00:51:14 | [diff] [blame] | 28 | If the repository url begins with ./ or ../, it is stored as |
| 29 | given but resolved as a relative path from the main project's |
| 30 | url when cloning. |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 31 | |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 32 | status:: |
| 33 | Show the status of the submodules. This will print the SHA-1 of the |
| 34 | currently checked out commit for each submodule, along with the |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame^] | 35 | submodule path and the output of `git-describe` for the |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 36 | SHA-1. Each SHA-1 will be prefixed with `-` if the submodule is not |
| 37 | initialized and `+` if the currently checked out submodule commit |
| 38 | does not match the SHA-1 found in the index of the containing |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame^] | 39 | repository. This command is the default command for `git-submodule`. |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 40 | |
| 41 | init:: |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 42 | Initialize the submodules, i.e. register in .git/config each submodule |
Junio C Hamano | 7a4a283 | 2007-07-07 21:53:22 | [diff] [blame] | 43 | name and url found in .gitmodules. The key used in .git/config is |
| 44 | `submodule.$name.url`. This command does not alter existing information |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 45 | in .git/config. |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 46 | |
| 47 | update:: |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 48 | Update the registered submodules, i.e. clone missing submodules and |
| 49 | checkout the commit specified in the index of the containing repository. |
| 50 | This will make the submodules HEAD be detached. |
Junio C Hamano | 0f7b5a9 | 2008-05-17 06:12:23 | [diff] [blame] | 51 | + |
| 52 | If the submodule is not yet initialized, and you just want to use the |
| 53 | setting as stored in .gitmodules, you can automatically initialize the |
| 54 | submodule with the --init option. |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 55 | |
Junio C Hamano | 8b588d5 | 2008-03-15 09:48:37 | [diff] [blame] | 56 | summary:: |
| 57 | Show commit summary between the given commit (defaults to HEAD) and |
| 58 | working tree/index. For a submodule in question, a series of commits |
| 59 | in the submodule between the given super project commit and the |
| 60 | index or working tree (switched by --cached) are shown. |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 61 | |
| 62 | OPTIONS |
| 63 | ------- |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 64 | -q:: |
| 65 | --quiet:: |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 66 | Only print error messages. |
| 67 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 68 | -b:: |
| 69 | --branch:: |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 70 | Branch of repository to add as submodule. |
| 71 | |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 72 | --cached:: |
Junio C Hamano | 8b588d5 | 2008-03-15 09:48:37 | [diff] [blame] | 73 | This option is only valid for status and summary commands. These |
| 74 | commands typically use the commit found in the submodule HEAD, but |
| 75 | with this option, the commit stored in the index is used instead. |
| 76 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 77 | -n:: |
| 78 | --summary-limit:: |
Junio C Hamano | 8b588d5 | 2008-03-15 09:48:37 | [diff] [blame] | 79 | This option is only valid for the summary command. |
| 80 | Limit the summary size (number of commits shown in total). |
Junio C Hamano | 1bdd3b0 | 2008-04-13 05:33:18 | [diff] [blame] | 81 | Giving 0 will disable the summary; a negative number means unlimited |
Junio C Hamano | 8b588d5 | 2008-03-15 09:48:37 | [diff] [blame] | 82 | (the default). This limit only applies to modified submodules. The |
| 83 | size is always limited to 1 for added/deleted/typechanged submodules. |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 84 | |
| 85 | <path>:: |
| 86 | Path to submodule(s). When specified this will restrict the command |
| 87 | to only operate on the submodules found at the specified paths. |
| 88 | |
| 89 | FILES |
| 90 | ----- |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 91 | When initializing submodules, a .gitmodules file in the top-level directory |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 92 | 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] | 93 | 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] | 94 | to each submodule url is "submodule.$name.url". See linkgit:gitmodules[5] |
Junio C Hamano | e66c6c0 | 2007-12-17 08:26:13 | [diff] [blame] | 95 | for details. |
Junio C Hamano | 38b693c | 2007-06-03 08:40:14 | [diff] [blame] | 96 | |
| 97 | |
| 98 | AUTHOR |
| 99 | ------ |
| 100 | Written by Lars Hjemli <hjemli@gmail.com> |
| 101 | |
| 102 | GIT |
| 103 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 104 | Part of the linkgit:git[1] suite |