Our application is for legacy reasons spread over around 200 git repositories, and it's becoming a nightmare to handle, as each development always impacts several repositories, we loose a lot of time during integration on pull requests.
Hence we would like to migrate to one single git repository.
However, since several users are doing active development on those repositories, we don't want to loose any on-going development (branch) during the migration to one repository.
Since everything is clearer with a diagram, we would like to go from this flat structure:
- ProjectA (branch master, dev1, fix1)
- ProjectB (branch master, dev1)
- ProjectC (branch master, dev2, fix1)
to this hierarchical structure, with only one main git repository:
Project (branch master, dev1, dev2, fix1)
|- projectA
|- projectB
|- projectC
Git subtree merge seems like the way to go at first, we can easily import the Project A, B and C but only on one branch, master for instance. If I try to branch Project and import another branch like dev1, git read-tree rejects me because the files are already there...
How can I achieve this?
EDIT: this looks like a duplicate of this question, but keeping the branches is not discussed.