X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=Documentation%2Fgit-submodule.txt;h=55bbc4f9303ce2f6e8d2797a329b6fa12f52bd92;hb=b13fd5c1a2bd450cdf7b853e0c4861f361882a18;hp=cd8e861ce4ae33b25928a16aa213933d2a38a155;hpb=7c74c3926ad60ba1bbfed13355f00a29813a0f32;p=git.git diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt index cd8e861ce..55bbc4f93 100644 --- a/Documentation/git-submodule.txt +++ b/Documentation/git-submodule.txt @@ -14,9 +14,9 @@ SYNOPSIS 'git submodule' [--quiet] status [--cached] [--] [...] 'git submodule' [--quiet] init [--] [...] 'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--rebase] - [--reference ] [--] [...] -'git submodule' [--quiet] summary [--summary-limit ] [commit] [--] [...] -'git submodule' [--quiet] foreach + [--reference ] [--merge] [--recursive] [--] [...] +'git submodule' [--quiet] summary [--cached] [--summary-limit ] [commit] [--] [...] +'git submodule' [--quiet] foreach [--recursive] 'git submodule' [--quiet] sync [--] [...] @@ -115,12 +115,16 @@ init:: update:: Update the registered submodules, i.e. clone missing submodules and checkout the commit specified in the index of the containing repository. - This will make the submodules HEAD be detached unless '--rebase' is - specified or the key `submodule.$name.update` is set to `rebase`. + This will make the submodules HEAD be detached unless '--rebase' or + '--merge' is specified or the key `submodule.$name.update` is set to + `rebase` or `merge`. + If the submodule is not yet initialized, and you just want to use the setting as stored in .gitmodules, you can automatically initialize the submodule with the --init option. ++ +If '--recursive' is specified, this command will recurse into the +registered submodules, and update any nested submodules within. summary:: Show commit summary between the given commit (defaults to HEAD) and @@ -130,18 +134,22 @@ summary:: foreach:: Evaluates an arbitrary shell command in each checked out submodule. - The command has access to the variables $path and $sha1: + The command has access to the variables $name, $path and $sha1: + $name is the name of the relevant submodule section in .gitmodules, $path is the name of the submodule directory relative to the superproject, and $sha1 is the commit as recorded in the superproject. Any submodules defined in the superproject but not checked out are ignored by this command. Unless given --quiet, foreach prints the name of each submodule before evaluating the command. + If --recursive is given, submodules are traversed recursively (i.e. + the given shell command is evaluated in nested submodules as well). A non-zero return from the command in any submodule causes the processing to terminate. This can be overridden by adding '|| :' to the end of the command. + -As an example, "git submodule foreach 'echo $path `git rev-parse HEAD`' will -show the path and currently checked out commit for each submodule. +As an example, +git submodule foreach \'echo $path {backtick}git +rev-parse HEAD{backtick}'+ will show the path and currently checked out +commit for each submodule. sync:: Synchronizes submodules' remote URL configuration setting @@ -180,6 +188,16 @@ OPTIONS This option is only valid for the update command. Don't fetch new objects from the remote site. +--merge:: + This option is only valid for the update command. + Merge the commit recorded in the superproject into the current branch + of the submodule. If this option is given, the submodule's HEAD will + not be detached. If a merge failure prevents this process, you will + have to resolve the resulting conflicts within the submodule with the + usual conflict resolution tools. + If the key `submodule.$name.update` is set to `merge`, this option is + implicit. + --rebase:: This option is only valid for the update command. Rebase the current branch onto the commit recorded in the @@ -197,6 +215,12 @@ OPTIONS *NOTE*: Do *not* use this option unless you have read the note for linkgit:git-clone[1]'s --reference and --shared options carefully. +--recursive:: + This option is only valid for foreach and update commands. + Traverse submodules recursively. The operation is performed not + only in the submodules of the current repo, but also + in any nested submodules inside those submodules (and so on). + ...:: Paths to submodule(s). When specified this will restrict the command to only operate on the submodules found at the specified paths.