You have a project
with a submodule
and a nested submodule
. it took me a while to figure out how to convert it to subtrees.
The basic reason is to convert is to make it so that deployment and installation by others is easier and doesn't create as many problems when branching.
The basic process to do this (there are others that involve splitting, but i found this to be easier). in a repo named with a :
- run
git submodule deinit .
- remove the submodule directory and .gitmodules (the whole file or relevent entries)
- commit changes (deletion of submodule)
git remote add <remote> <sub module's repo url>
- run
git subtree add --prefix=<module directory> <remote>
- push the repo back out, use a seperate branch if necessarry:
git push <remote-name> <branch-name>
orgit push <remote-name> <local-branch-name>:<remote-branch-name>
To get this to work in any appreciable way, you need to start with the most deeply nested submodule. Repeat the steps above, push the submodule's parent project out to (wherever), and then move up one and repeat.
The problem with this approach will be if you don't own the relevent submodules. you'll need to fork them first.