Migrate Java submodules to a new repo
There are many different ways to migrate files/directories from one git repo to another, like creating log patch, format-patch, using filter-branch --subdirectory-filter. but it is difficult to create patch and modify the module structure simultaneously, e.g. migrate submodules of a submodule to the new repo and move them one level up to the root folder.
I figured out the simplest way to do it with filter-repo and then rebase.
As the example, we will migrate the elasticsearch connectors to the external repo
Filter the origin repo
Rebase the new repo
Now, you should have all elasticsearch connectors in the new repo with all commit history. It is then up to you if you want to modify the module structure via refactoring.
Rebase for the PR
Given the master branch is where your repo forked from. Before starting a PR, you should rebase your branch to the master branch.
Now, you are ready to start the PR.
Last updated
Was this helpful?