This is based on this very informative post.
diff.submodule = log
(so you get clearer container diffs when referenced submodule commits changed).fetch.recurseSubmodules = on-demand
(so you are confident new referenced commits for known submodules get fetched with container updates).status.submoduleSummary = true
(so git status gets useful again when a referenced submodule commit changed).
- Initial add:
git submodule add <url> <path>
- Initial container clone:
git clone --recursive <url> [<path>]
cd path/to/module
git fetch
git checkout -q <commit-sha1>
cd -
git commit -am “Updated submodule X to: blah blah”
git pull
git submodule sync --recursive
git submodule update --init --recursive
git submodule update --remote --rebase -- path/to/module
cd path/to/module
Local work, testing, eventually staging
git commit -am “Update to central submodule: blah blah”
git push
cd -
git commit -am “Updated submodule X to: blah blah”
git submodule deinit path/to/module
git rm path/to/module
git commit -am “Removed submodule X”