I\'m trying to use git submodules for aggregating 10+ repositories into one structure for easy development.
It is supposed to clone the module and checkout a branch.
In order to get this done, I always use the following command (slightly based on VonCs proposal earlier:
export top=$(pwd)
git submodule foreach --recursive 'b=$(git config -f ${top}/.gitmodules submodule.${path}.branch); case "${b}" in "") git checkout ${sha1};; *) git checkout ${b}; git pull origin ${b};; esac'
It checks out all submodules (recursively) at their "right" branch (if set) and otherwise at the head as last committed.