Q: You ran `git merge` and Git stopped with conflicts in three files. Walk me through exactly how you resolve them, and explain what the conflict markers mean.
Git stopped because it couldn't auto-merge — both branches changed the same lines.
#Git #Branching, Merging & Conflicts #L2 #Version Control #Collaboration #Terraform State
🎙️ Candidate Opening & Architectural Context
""During a major release branch cut, we encountered this exact scenario and used Git internals to recover cleanly. The interviewer is testing: Practical conflict resolution, understanding of three-way merge.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Initial Diagnostics & Root Cause Analysis
Git stopped because it couldn't auto-merge — both branches changed the same lines.
- See what's conflicted:
- Open each file. You'll see markers like:
- Edit the file to the correct final state and remove all
<<<,===,>>>markers. Don't just pick a side blindly — re-read both intents.
2️⃣
Remediation & Permanent Safeguards
HEAD is what's on the branch you're merging *into*. The lines below ======= are from the branch you're merging *in*. The ||||||| (if merge.conflictstyle = diff3 is set) shows the common ancestor — extremely useful for understanding intent. For repeated conflicts on the same hunk in long-lived branches, enable git rerere so Git remembers your resolution next time.
git status # files marked "both modified"
- Mark resolved and finish:
- If you panic,
git merge --abortputs you back where you started.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: See what's conflicted:."
⚡ 60-Second Elevator Pitch Talking Points
- See what's conflicted:
- Open each file. You'll see markers like:
- Edit the file to the correct final state and remove all , ===, >>> markers. Don't just pick a sid...
Advertisement