How do you resolve a merge conflict?easy

Type
applied
Topic
merging
Frequency
very common
Tags
merging
Answer

Open conflicted files, choose which version of each section to keep (or combine them), remove the conflict markers, stage the resolved files, then complete the merge or rebase.

Explanation

Conflict markers show HEAD (your changes), the incoming changes, and the common ancestor. After editing, git add marks the file as resolved. For complex conflicts, a three-way diff tool (VS Code, vimdiff, IntelliJ) shows all three versions side-by-side. Frequent small merges and keeping branches short-lived reduce conflict severity.

Follow-upHow do you avoid conflicts when multiple engineers work on the same file?