ed5978 ed5978 - 6 months ago 44
Git Question

How can I merge 2 git repositories?

I have two git repositories, say project1 and project2, and project2 is located in a subfolder of project1 :

/project1/.git (with contents of project2/ ignored)

I would like to know how I can merge project2 into project1, with the same folder structure, but keeping the history of project2 ?

I there a simple solution for that ?


Finally, I moved project2 into a temporary folder, then :

git subtree add -P project2 ~/tmp_project2 PROJECT2_BRANCH

did the job very well.