ed5978 ed5978 - 1 year ago 111
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 ?

Answer Source

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

git subtree add -P project2 ~/tmp_project2 PROJECT2_BRANCH

did the job very well.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download