Let's talk about git conflicts.
OK, we hate them 😅, but let move on.
You may have faced to the classic way for git to report issue.
Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed,
or cleanly resolved because both sides changed the same way.
<<<<<<< yours:sample.txt
Conflict resolution is hard;
let's go shopping.
=======
Git makes conflict resolution easy.
>>>>>>> theirs:sample.txt
And here is another line that is cleanly resolved or unmodified.
It's convient, BUT you can have something better by activating this git config setting
git config --global merge.conflictstyle zdiff3
You will find more information in the manual https://git-scm.com/docs/git-merge/2.38.0#_how_conflicts_are_presented
The zdiff3 is a zealous variation of diff3 that exists for a while now.
Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed,
or cleanly resolved because both sides changed the same way.
<<<<<<< yours:sample.txt
Conflict resolution is hard;
let's go shopping.
||||||| base:sample.txt
or cleanly resolved because both sides changed identically.
Conflict resolution is hard.
=======
Git makes conflict resolution easy.
>>>>>>> theirs:sample.txt
And here is another line that is cleanly resolved or unmodified.
This mode allows you to get more context about the conflict.
It helped me a lot since I started using last year.
Top comments (2)
If you want more information I recommend this detailed article
neg4n.dev/blog/understanding-zealo...
It is a really helpful post! Learned alot from it 👍