timestamp_t: a new data type for timestamps
[gitweb.git] / Documentation / git-submodule.txt
index 0105bdbe1c9da3c0057b6d6ed5aa1ed69099e225..74bc6200d564c6aa72183e393f7c7d2e0c00bf7d 100644 (file)
@@ -73,13 +73,17 @@ configuration entries unless `--name` is used to specify a logical name.
 +
 <repository> is the URL of the new submodule's origin repository.
 This may be either an absolute URL, or (if it begins with ./
-or ../), the location relative to the superproject's origin
+or ../), the location relative to the superproject's default remote
 repository (Please note that to specify a repository 'foo.git'
 which is located right next to a superproject 'bar.git', you'll
 have to use '../foo.git' instead of './foo.git' - as one might expect
 when following the rules for relative URLs - because the evaluation
 of relative URLs in Git is identical to that of relative directories).
-If the superproject doesn't have an origin configured
++
+The default remote is the remote of the remote tracking branch
+of the current branch. If no such remote tracking branch exists or
+the HEAD is detached, "origin" is assumed to be the default remote.
+If the superproject doesn't have a default remote configured
 the superproject is its own authoritative upstream and the current
 working directory is used instead.
 +
@@ -118,18 +122,26 @@ too (and can also report changes to a submodule's work tree).
 
 init [--] [<path>...]::
        Initialize the submodules recorded in the index (which were
-       added and committed elsewhere) by copying submodule
-       names and urls from .gitmodules to .git/config.
-       Optional <path> arguments limit which submodules will be initialized.
-       It will also copy the value of `submodule.$name.update` into
-       .git/config.
-       The key used in .git/config is `submodule.$name.url`.
-       This command does not alter existing information in .git/config.
-       You can then customize the submodule clone URLs in .git/config
-       for your local setup and proceed to `git submodule update`;
-       you can also just use `git submodule update --init` without
-       the explicit 'init' step if you do not intend to customize
-       any submodule locations.
+       added and committed elsewhere) by setting `submodule.$name.url`
+       in .git/config. It uses the same setting from .gitmodules as
+       a template. If the URL is relative, it will be resolved using
+       the default remote. If there is no default remote, the current
+       repository will be assumed to be upstream.
++
+Optional <path> arguments limit which submodules will be initialized.
+If no path is specified and submodule.active has been configured, submodules
+configured to be active will be initialized, otherwise all submodules are
+initialized.
++
+When present, it will also copy the value of `submodule.$name.update`.
+This command does not alter existing information in .git/config.
+You can then customize the submodule clone URLs in .git/config
+for your local setup and proceed to `git submodule update`;
+you can also just use `git submodule update --init` without
+the explicit 'init' step if you do not intend to customize
+any submodule locations.
++
+See the add subcommand for the defintion of default remote.
 
 deinit [-f|--force] (--all|[--] <path>...)::
        Unregister the given submodules, i.e. remove the whole
@@ -154,13 +166,13 @@ Update the registered submodules to match what the superproject
 expects by cloning missing submodules and updating the working tree of
 the submodules. The "updating" can be done in several ways depending
 on command line options and the value of `submodule.<name>.update`
-configuration variable. Supported update procedures are:
+configuration variable. The command line option takes precedence over
+the configuration variable. if neither is given, a checkout is performed.
+update procedures supported both from the command line as well as setting
+`submodule.<name>.update`:
 
        checkout;; the commit recorded in the superproject will be
-           checked out in the submodule on a detached HEAD. This is
-           done when `--checkout` option is given, or no option is
-           given, and `submodule.<name>.update` is unset, or if it is
-           set to 'checkout'.
+           checked out in the submodule on a detached HEAD.
 +
 If `--force` is specified, the submodule will be checked out (using
 `git checkout --force` if appropriate), even if the commit specified
@@ -168,23 +180,21 @@ in the index of the containing repository already matches the commit
 checked out in the submodule.
 
        rebase;; the current branch of the submodule will be rebased
-           onto the commit recorded in the superproject. This is done
-           when `--rebase` option is given, or no option is given, and
-           `submodule.<name>.update` is set to 'rebase'.
+           onto the commit recorded in the superproject.
 
        merge;; the commit recorded in the superproject will be merged
-           into the current branch in the submodule. This is done
-           when `--merge` option is given, or no option is given, and
-           `submodule.<name>.update` is set to 'merge'.
+           into the current branch in the submodule.
+
+The following procedures are only available via the `submodule.<name>.update`
+configuration variable:
 
        custom command;; arbitrary shell command that takes a single
            argument (the sha1 of the commit recorded in the
-           superproject) is executed. This is done when no option is
-           given, and `submodule.<name>.update` has the form of
-           '!command'.
+           superproject) is executed. When `submodule.<name>.update`
+           is set to '!command', the remainder after the exclamation mark
+           is the custom command.
 
-When no option is given and `submodule.<name>.update` is set to 'none',
-the submodule is not updated.
+       none;; the submodule is not updated.
 
 If the submodule is not yet initialized, and you just want to use the
 setting as stored in .gitmodules, you can automatically initialize the
@@ -223,9 +233,12 @@ foreach [--recursive] <command>::
        the processing to terminate. This can be overridden by adding '|| :'
        to the end of the command.
 +
-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.
+As an example, the command below will show the path and currently
+checked out commit for each submodule:
++
+--------------
+git submodule foreach 'echo $path `git rev-parse HEAD`'
+--------------
 
 sync [--recursive] [--] [<path>...]::
        Synchronizes submodules' remote URL configuration setting