Conflicts identify changes Git cannot combine automatically. Resolution must preserve intended behavior, not merely remove markers.
Before you start
You should understand commits, branches, the working tree and the staging area. Draw the commit graph before changing history. Try commands in a disposable repository with a clean working tree so you can observe exactly which references and files each operation changes.
The practical goal is to reason through this situation: Two branches modify validation rules; the resolved code must satisfy both valid requirements. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.
Step-by-step walkthrough
Step 1: Read both intents
Determine why each branch changed the conflicting region.
Step 2: Resolve behavior
Combine compatible requirements rather than only deleting conflict markers.
Step 3: Review and validate
Inspect the combined diff and exercise affected behavior before completion.
Worked scenario
Two branches modify validation rules; the resolved code must satisfy both valid requirements.
One branch rejects empty names; another trims whitespace. Choosing either whole file can lose the other’s rule. The intended resolution trims first and rejects an empty normalized result if both requirements apply. A syntactically clean merge does not prove that both behaviors survived.
Common mistake
Choosing ours or theirs for an entire file can discard unrelated work.
Verify the behavior
Test ordinary names, empty input and whitespace-only input after resolution.
Interview exercise
Verify a resolution.
Answer and reasoning
Read surrounding code, inspect the combined diff and run the affected behavior checks before completing the merge.
Continue learning
Compare the scenario with the Git and CI/CD interview questions and test your understanding with the Git and CI/CD MCQs. For terminology and implementation details, consult the reference material.