0

I have a question regarding git repository migrations.

Currently, I am working on a multi-repository project, namely project-1 and project-2, each with its own git repository.

Now, I would like to create a new project called project and move project-1 and project-2 inside it while preserving the history of each project. Is this possible?

I am aware of git-submodules and git in git, but in our case, we need to merge these projects. Each module (project-1, project-2, etc.) is part of the same product, and we plan to merge them in the near future. It would be helpful if we could retain the entire history.

Thank you.

I tried git-submodules but its not the same, since we need to maintain the submodule workflow.

I found a related question but I think it's not going to work for my case.

Moving Git repository content to another repository preserving history

Yorgos S.
  • 19
  • 5
  • Why would your linked answer not work in your case? A merge is the only thing you need really. And the only way you can preserve the history of two separate branches. – MrAnima Jul 20 '23 at 14:55
  • I answered something like this kind of recently.... let me see if i can find it quickly – eftshift0 Jul 20 '23 at 14:56
  • 1
    Let me know if this is more or less what you are looking for https://stackoverflow.com/a/76533322/2437508 – eftshift0 Jul 20 '23 at 14:58
  • @eftshift0 Thanks for your comment. I'll take a look and I'll let you know. – Yorgos S. Jul 20 '23 at 15:01
  • See 2 different answers at https://stackoverflow.com/q/75348228/7976758 – phd Jul 20 '23 at 15:32
  • just use a subtree merge to merge the two projects together – UpAndAdam Jul 20 '23 at 16:18
  • I think using the git-subtree you going to lose the history of each project. I just found another solution, using git filter-branch here: https://stackoverflow.com/questions/277029/combining-multiple-git-repositories – Yorgos S. Jul 21 '23 at 07:47
  • I just tried the above solution using and seemed to work perfectly. The only catch is that one of the commands used sed. keep in mind that in MacOs is different. In this case you can install the gnu-sed with brew (brew install gnu-sed) and then replace "sed" with "gsed" and everything should work as expected. – Yorgos S. Jul 21 '23 at 10:55

0 Answers0