turning a submodule into a regular folder, keeping commit history
at work I had to turn a submodule inside a repo into a regular subfolder. reason was: it did not make sense anymore to treat that as a submodule, since only the repo it was used in would make use of it. I ended up doing the following
git submodule statusto get the paths of all submodulesgit submodule deinit path/to/submodulegit rm path/to/submodulerm -rf .git/modules/path/to/submodule
now all traces of the submodule are gone, you could commit the current state (something like "deletes submodule foo")
then, you can re-add the repo using subtree, which will preserve all commit history, but check it in as a regular folder
git subtree add --prefix=path/to/submodule <submodule-url> <branch-name>
in the subtree command, path/to/submodule is the repository folder itself, not the folder that should contain it!
just thought I'd write it down somewhere.