0

We am trying to move from multirepo to monorepo. In addition to move several repositories to one repository, we have several branches on each of the repositories. At least we have updated all the branches to not be behind main branch.

The current status multirepo

  • repo1
    • main
    • branch1
    • branch1
  • repo2
    • main
    • branch1
    • branch2
  • repo3
    • main
    • branch1
    • branch2

The monorepo folder structure

  • apps/repo1
  • apps/repo2
  • apps/repo3

Expected branches in the monorepo

  • main
  • repo1-branch1
  • repo1-branch2
  • repo2-branch1
  • repo2-branch2
  • repo3-branch1
  • repo3-branch2

As you can see in the example above, we expect that each repository code will be move into the "apps" folder. We want to do this keeping all commits history with the exception of tags.

We have tried some alternatives, but it gets complicated with the branches because after we have moved the code (main) to a subfolder (apps/repo1), the branches will have a big diff.

Anyone as a recipe step by step to perform these tasks.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
  • There are many similar questions about this on this site. Maybe search for “merging repositories”; “git subrees”; “combining repositories”; “joining repositories”; “merge unrelated histories”. – Guildenstern May 06 '23 at 19:48
  • Thanks @Guildenstern, but I am not looking for a similar question. I need an specific answer for it. The main problem that I am facing is the major diff when doing a pull request of the branches in the new monorepo moving after having moved the main branch to a new subfolder. – Rodrigo Sedano May 07 '23 at 10:41
  • Those questions and answers focus on exactly the case of moving multiple repositories into one repository where each repository is moved into a subdirectory. [For example](https://stackoverflow.com/a/14470212/1725151) – Guildenstern May 07 '23 at 11:42

0 Answers0