Is it somehow possible to initialize all the submoudules as listed in .gitmodules and force pull all of them.
You could delete all the submodule directories and then re-run git submodule update
. Maybe like this:
git config -f .gitmodules --list |
awk -F= '$1 ~ /.path$/ {print $2}' |
xargs rm -rf
This uses git config
to list the configuration in .gitmodules
, which produces output like this:
submodule.common.path=common
submodule.common.url=https://github.com/purpleidea/puppet-common.git
We use awk
to extract the path information, and then pass that to xargs
to delete all the submodule directories. Running submodule update
will then re-populate those directories:
$ git submodule update
Submodule path 'common': checked out '2c0ed2844c606fd806bde0c02e47e79c88fab4a9'
Additionally I would like to reset all of the submodules and discard any changes locally present.
Because we're deleting and re-cloning the submodules, this will also discard any local changes.