Conflict markers are hard to understand because you cannot see the original text. How do you get more context?
IntermediateScenarioBranching and Merging Workflows
Answer
Situation read → The default conflict style shows only two sides.
What I'd do →
- Switch to the three-way style:
git config --global merge.conflictStyle zdiff3(Git 2.35+; usediff3on older versions). - Re-create markers in the current file:
git checkout --conflict=zdiff3 -- file. - Now the middle
|||||||section shows the common ancestor, so you see what each side changed. - Use
git mergetoolor an IDE three-pane view for large conflicts.
Why → Knowing the base tells you who changed what, which is often the whole puzzle.
Interview tip → zdiff3 also trims common lines from the markers, making them shorter than diff3.
More on Branching and Merging Workflows
You run `git pull` and Git stops with a merge conflict in `app.py`. What do you do?BeginnerYour feature branch is three weeks old and `main` has moved a lot. Merge `main` in, or rebase onto it?IntermediateThe team argues about fast-forward merges versus merge commits on `main`. How do you settle it?BeginnerA teammate branched from the wrong base, and their PR shows 40 unrelated commits. How do you fix it?IntermediateBefore merging, you want to see exactly what the feature branch adds compared to `main`. Which commands?BeginnerHalfway through a merge you realise you pulled the wrong branch. How do you back out?Beginner