Reputation: 487
I'm planning to split a monolithic application into a micro service based architecture, but I want to keep the GIT history.
The monolit should be split into three micro services.
My first approach would be, copying the GIT Repository three times and removing all non domain specific parts from the new micro service which should keep the most parts of the git history alive. But I am not shure if this is the best way keeping the version control history.
Upvotes: 0
Views: 116
Reputation: 14499
You can use git filter-branch
with the --subdirectory-filter
option to filter a subdirectory of your repository and thus make the repository contain the subfolder as root directory. This is described in step 5 here, documentation here might also help. You would have to clone your repository three times and run filter-branch
in each of those for a different part of your project.
Since (with said --subdirectory-filter
) only subdirectories can be treated this way, you may have to rearrange your repository before. The advantage over the naive deletion of other parts is, however, that by using filter-branch
you will only preseve history that concerns the actual content of your repository, and do not have any history of the parts filtered out.
Upvotes: 1