git-submodule update: Add --branch option
This allows users to checkout the current
superproject-recorded-submodule-sha as a branch, avoiding the detached
head state that the standard submodule update creates. This may be
useful for the existing --rebase/--merge workflows which already avoid
detached heads.
It is also useful if you want easy tracking of upstream branches. The
particular upstream branch to be tracked is configured locally with
.git/modules/<name>/config. With the new option Ævar's suggested
$ git submodule foreach 'git checkout $(git config --file $toplevel/.gitm
odules submodule.$name.branch) && git pull'
reduces to a
$ git submodule update --branch
after each supermodule .gitmodules edit, and a
$ git submodule foreach 'git pull'
whenever you feel like updating the submodules. Your still on you're
own to commit (or not) the updated submodule hashes in the
superproject's .gitmodules.
Signed-off-by: W. Trevor King <wking@tremily.us>