N Sharma
N Sharma

Reputation: 34507

How can two developers work on same file using git

I was using SVN last where two developers can work on same file . Suppose A developer edit the A.java on 31 line and Suppose B developer edit the A.java on 35 line.

In case of SVN first A developer commit the code then if B second developer take update then that SVN code merge on local sytem of second B developer then can commit.

But this git does not allow. When two developers edited same file and one commited the source and other also edited same file it does not merge the code it gives below error.

Any solution to this problem ?

Thanks in advance.

enter image description here

Upvotes: 0

Views: 3923

Answers (1)

Eran
Eran

Reputation: 394016

You should commit your local changes, and then merge with the other user's changes - if you do a pull command, the merge will happen automatically, otherwise you have to fetch the remote branch and then merge to your local branch.

If you worked on different lines, the merge will succeed automatically. Otherwise, you might have to resolve conflicts manually.

Upvotes: 4

Related Questions