We have been working with Jazz-RTC for around 15 years and are forced to migrate to git in a short time-frame.
Our workflow was such, that we created streams for each release containing components, that represented the different folders of the project, i.e. server
, gui
, doc
, db
, etc.
Over time we added new components to newer streams so that the code-base now looks something like this:
V1.0
|_server
|_gui
|_db
V2.0
|_server
|_gui
|_db
|_doc
V2.5
|_server
|_gui
|_db
|_doc
V3.0
|_server
|_gui
|_db
|_doc
|_reports
....
Our migration script is working in a way such that for each stream (V2.0
, V3.0
,...) it takes each component (server
, gui
, ...) and creates a separate Git repository from it.
The change-sets are applied as commits in each respective repository so that we have retained the history for every component. This also means, that we have no branches in each repository, just a linear commit-history on a single (master) branch.
It's obvious, that there is duplicated code in the Git repos. E.g. in V2.0 the server
repo has mostly similar files from the V3.0 server
repo, with only minor changes on some files.
What we'd like to do now, is to combine these different Git repositories into one, so that the structure looks something like this:
Combined_Project
|_server
|_gui
|_db
|_doc
|_reports
Of course we need the history of file-changes (i.e. commits) to be in the right order (ordered by Date).
In order to achieve this task we would appreciate any Git-internal solution but we would also accept using third party tools.
I have researched this topic for days now, but the more info I find about it, the more confused I get.
Doing a simple git remote add -f V2.0gui <gui-from-other-repo>
followed by git merge V2.0gui/master
creates a merge-commit and merges the repositories but in the logs I see, that the commits are not in the right order (e.g we have commits from March 2022 that come before commits from January 2022).
I have tried to rebase the "remote" repositories into a common repo but this also messes up the commit history.
The question is, how would this task be tackled in the best way? What tools or strategies would you use?
Update: As the whole code has been worked on in a linear fashion, it would suffice to have one Git repository with no branches as a result. This means, that the commits of the different repositories should be all on the master branch of the resulting repo (depending on their date of check-in/commit).