Show the base in conflicts with zdiff3
Use zdiff3 conflict markers to see the merge base and trim matching lines from the edges of a conflict.
You open a conflicted file and find two versions of one line, yours and theirs. Neither tells you what the line said before either branch touched it, so you guess which side to keep.
I reproduced this in a scratch repo. main and feature both moved the timeout under a new [limits] heading and changed its value. Git's default markers look like this:
name = app
[limits]
<<<<<<< HEAD
timeout = 45
=======
timeout = 60
>>>>>>> feature
[end]
log = infoYou see 45 against 60. You cannot tell if 45 raised the value or lowered it, or if one side left it alone.
Ask for the base
Abort the merge, then set the conflict style once and merge again.
git merge --abort
git config --global merge.conflictStyle zdiff3
git merge featureThe merge stops on the same conflict, and the file now has a third section.
name = app
[limits]
<<<<<<< HEAD
timeout = 45
||||||| 261c3ed
timeout = 30
=======
timeout = 60
>>>>>>> feature
[end]
log = infoBetween ||||||| and ======= sits the common ancestor, labelled with the abbreviated id of the merge base commit. The original was 30. Both branches raised it, so you are choosing between two numbers and you know what each side did.
Read the base first and compare each side to it. A side that equals the base changed nothing, so you keep the other side and move on. A side that differs from the base made a decision, and those are the lines worth your attention.
Why zdiff3 over diff3
diff3 also prints the base. In my scratch repo it gave an 11-line conflict, because it repeated [limits] and [end] in both branch sections. The base had neither line.
zdiff3 moves matching lines from the start and end of the two branch sections outside the markers. The conflict above is 7 lines and holds the one line that differs. Git 2.35 added the value, and I set it on every machine I use.
Fix a conflict you are already in
Changing the config leaves the markers already in the file as they are. Run git checkout --merge -- config.txt on each conflicted file and Git rebuilds the markers in the new style. The base section appears, and the labels read ours, base and theirs in place of HEAD and the branch name.
Your edits to that file are gone after the checkout, so do it before you resolve anything.