Skip to content

Moving repo A into another repo B without erasing repo B's existing code #440

Answered by lflo5727
lflo5727 asked this question in Q&A
Discussion options

You must be logged in to vote

I was able to resolve this using both git-filter-repo and git merge.
I used git-filter-repo to restructure the file tree in my-repo-a to match the structure it should belong under in the monorepo.

Then in my monorepo I added the local path to my-repo-a as a remote

git remote add my-repo-a ../my-repo-a

After that I ran git fetch my-repo-a --tags and then merged.

git merge --allow-unrelated-histories my-repo-a/main

And that did exactly what I needed. Got all the files where they belonged, nothing was overidden and the full history was intact.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lflo5727
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant