I only found answers on how to use git subtrees to split up a repository. However, I explicitly want submodules.
It's a Java maven project. Currently, everything is in one maven project and one repository. My goal is to achieve something like this:
The root repository should contain the main pom.xml, system documentation, etc Then there should be a few submodules, one for a utility library, one for the main application, and so on. The submodules are their own maven project, referenced from the main maven project in the root repository. The root repository will not contain any source code.
I could create everything new from current HEAD, but it is important to me that the commit history is kept as complete as possible.
Thats exactly what u need to do. Split the "main" into branches with
git subtree split <path> -b <branch>
and then add remote for each submodule and push the branch to the remote.Once you have all your submodules set up add them to the "main" repo