'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]
'git submodule' [--quiet] init [--] [<path>...]
'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--rebase]
- [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
+ [--reference <repository>] [--merge] [--pull] [--recursive] [--]
+ [<path>...]
'git submodule' [--quiet] summary [--cached|--files] [(-n|--summary-limit) <n>]
[commit] [--] [<path>...]
'git submodule' [--quiet] foreach [--recursive] <command>
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` or
- `--merge` is specified or the key `submodule.$name.update` is set to
- `rebase`, `merge` or `none`. `none` can be overridden by specifying
- `--checkout`.
+ checkout the commit specified in the index of the containing
+ repository. This will make the submodules HEAD be detached unless
+ `--rebase`, `--merge`, or `--pull` is specified or the key
+ `submodule.$name.update` is set to `rebase`, `merge`, `pull`, or
+ `none`. `none` can be overridden by specifying `--checkout`.
+
If the submodule is not yet initialized, and you just want to use the
setting as stored in .gitmodules, you can automatically initialize the
If the key `submodule.$name.update` is set to `merge`, this option is
implicit.
+--pull::
+ 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 `pull`, this option is
+ implicit.
+
--rebase::
This option is only valid for the update command.
Rebase the current branch onto the commit recorded in the
USAGE="[--quiet] add [-b branch] [--follow-branch[=<branch>]] [-f|--force] [--reference <repository>] [--] <repository> [<path>]
or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: $dashless [--quiet] init [--] [<path>...]
- or: $dashless [--quiet] update [--init] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
+ or: $dashless [--quiet] update [--init] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--pull] [--recursive] [--] [<path>...]
or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
or: $dashless [--quiet] foreach [--recursive] <command>
or: $dashless [--quiet] sync [--] [<path>...]"
-m|--merge)
update="merge"
;;
+ -p|--pull)
+ update="pull"
+ ;;
--recursive)
recursive=1
;;
fi
name=$(module_name "$sm_path") || exit
url=$(git config submodule."$name".url)
+ branch=$(git config submodule."$name".branch)
if ! test -z "$update"
then
update_module=$update
update_module= ;;
esac
+ res=
must_die_on_failure=
case "$update_module" in
rebase)
say_msg="$(eval_gettext "Submodule path '\$sm_path': merged in '\$sha1'")"
must_die_on_failure=yes
;;
+ pull)
+ die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$sm_path'")"
+ say_msg="$(eval_gettext "Submodule path '\$sm_path': merged in '\$sha1'")"
+ must_die_on_failure=yes
+ (clear_local_git_env; cd "$sm_path" && git checkout "$branch" && git pull --ff-only)
+ res=$?
+ ;;
*)
command="git checkout $subforce -q"
die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$sm_path'")"
;;
esac
- if (clear_local_git_env; cd "$sm_path" && $command "$sha1")
+ if test -z "$res"
+ then
+ (clear_local_git_env; cd "$sm_path" && $command "$sha1")
+ res=$?
+ fi
+ if test $res -eq 0
then
say "$say_msg"
elif test -n "$must_die_on_failure"