0

We have project named: ABC

I have committed all my source code using Git, but there is another person who worked for me on the same project, didn't use git, and now after 2 months we need to merge our code. Is there a way we can do that easily; is there any tool available for it?

David Deutsch
  • 13,210
  • 3
  • 41
  • 45
Muhammad
  • 2,851
  • 4
  • 38
  • 64

2 Answers2

2

First of all have that person's code committed to your repo in a different branch. Then use git merge to merge with your own branch. If there is any conflict in merging git will inform and ask you to make changes before merge can take place.

You can refer these answers to get clear idea:

Merging two branch

Fix merge conflicts.

Community
  • 1
  • 1
AKJ
  • 188
  • 1
  • 13
2

To get the most accurate merge possible with a minimum of conflicts, you need to know the commit at which you made the snapshot that the other developer worked on; let's call it abc123. Create a branch at that point with git checkout -b myBranch abc123. Then, overwrite your code with his copy, and do:

git commit
git checkout master   #assuming master is the branch you work on
git merge myBranch

You will most likely have some conflicts, but because you branched off from the snapshot point, git will be able to do a lot of automatic merging for you.

David Deutsch
  • 13,210
  • 3
  • 41
  • 45