Merge two project with GIT

218 Views Asked by At

I have multiple projects that (Dynamics CRM solutions for those who knows) that have have the same folder structure and I need to merge one project with another in order to:

  • Merge files that have the same name.
  • Add files from one project to the other if not exists.

What would be the best way doing it with GIT ?

  • I have tried to create a single repository where I've uploaded project A. Then, I've created a branch from it where I've placed the project B. When I merge the branch project B into the branch project A, files from project A with the same name of project B are replaced by those from project B.
  • I have also tried the submodules concept but it isn't finally the right thing to do.
1

There are 1 best solutions below

2
Stanislav Bashkyrtsev On

If you want to keep the history and the fact that they were merged, then:

git clone git@projecta
cd projecta
git remote add -f projectb git@projectb
git merge projectb/master

If you don't care about history - then just place files manually and commit. It's possible to make a merge commit (that points to 2 parents) even in case of manual merge with low-level commands like git-commit-tree.