Skip to content

Git submodules

Helper tools

  • Stale and unmaintained: https://github.com/kollerma/git-submodule-tools

change submodule url

local

edit .gitmodules, change url

git submodule sync && git submodule update --init
git add -u
git commit -m"changes submodule url for…"
git push

on every other checkout dir (i.e. puppet server)

git pull
git submodule sync && git submodule update --init

Delete a submodule

https://stackoverflow.com/a/1260982

local

git submodule deinit <path_to_submodule>
git rm <path_to_submodule>
git commit-m "Removed submodule "
rm -rf .git/modules/<path_to_submodule>

on server checkout dir

rm -rf modules/dovecot
rm -rf .git/modules/modules/dovecot
vi .git/config   # remove submodule