Reputation: 5263
Here is the scenario:
User A and B has the same source code. User A makes a changes => add => commit => push. The source code in remote repository is changed.
User B start changing without pulling. (or maybe changes in remote repository is applied after user B pulled the repository) Then he also wants to push. At this moment, conflict occurs. I searched a lot and couldn't find any solution, but to edit conflicts manually.
Question: Is editing conflicts manually an efficient way? Specially in a big project? What is the approach?
Upvotes: 1
Views: 113
Reputation: 17858
Manual conflict resolution is the way to go. Conflict means that developer B relies on some code that was changed. This means he has to adapt his code to the changes made by developer A. That is - to resolve this conflict.
Sometimes that conflict can be resolved automatically. Sometimes it can be resolved by simply choosing an option like "ours after theirs". However even if there is no conflict in git's sense, it is possible that the code still has to be corrected.
For example: there is a function some_func
that accepts some arguments. Developer A renames it to some_new_name
, while developer B adds the call to some_func
in some completely separate area of code. The merge will happen without any conflict but the code will not work properly.
Actually having a conflict might be better than not having one - you get the early warning that the code that you wrote has to be changed.
Upvotes: 1
Reputation: 5229
Managing merge conflicts manually can be a cumbersome task.
Try git mergetool
and it will open the default mergetool although you have to install a mergetool first.
There are several mergetools which can help you resolve conflict such as meld
, opendiff
, kdiff3
, tkdiff
, xxdiff
, tortoisemerge
, gvimdiff
, diffuse
, ecmerge
, p4merge
, araxis
, vimdiff
, emerge
.
After installing it just execute and it will open the installed mergetool, it will provide you with a gui that will steps you through each conflict, and you get to choose how to merge.
If you use IDEs like IntelliJ they provide and inbuilt tool to fix merge conflicts.
Upvotes: 1