DEV Community

Thomas
Thomas

Posted on

Mono-repo: merge 2 git repositories

First to avoid conflicts, move all files (including dotfiles) into a subfolder and commit.

Then merge the 2 repositories with the example script below (from: https://stackoverflow.com/a/10548919/856151).

cd path/to/project-b
git remote add project-a path/to/project-a
git fetch project-a --tags
git merge --allow-unrelated-histories project-a/master # or whichever branch you want to merge
git remote remove project-a

--allow-unrelated-histories is the "keyword" since Git 2.9.

Top comments (0)