Interview Prep/Git & GitHub/Branching and Merging Workflows

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 →

  1. Switch to the three-way style: git config --global merge.conflictStyle zdiff3 (Git 2.35+; use diff3 on older versions).
  2. Re-create markers in the current file: git checkout --conflict=zdiff3 -- file.
  3. Now the middle ||||||| section shows the common ancestor, so you see what each side changed.
  4. Use git mergetool or 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.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows