How do I read Git conflict markers when two branches change the same lines?
Quick answer
In a typical Git merge conflict, <<<<<<< begins the current-side text, ======= separates it from the other-side text, and >>>>>>> marks the end of that other-side section. These are competing edits, not a completed answer. Choose or combine the intended content, remove every conflict marker, review the resulting file, and then stage the resolved file. The labels and marker style can vary with the merge context and configuration. [S1]
The question, the details, the next step.
A practical checklist
Identify the current-side and other-side sections using the markers; treat labels as context-dependent.
Compare both edits with the surrounding file and the purpose of the changes.
Choose or combine content based on the intended final result, not on marker order alone.
Remove the conflict markers and reread the resolved section in context.
Stage the resolved file after reviewing it; staging is not proof that the result is correct.
A few more useful answers
What does `=======` mean in a conflict?
It separates the current-side section from the other-side section in Git’s usual textual conflict-marker style. It is a divider, not a choice or a final line of content. [S1]
Why does my conflict show a base version too?
Git can show the common-ancestor base in diff3 or zdiff3 marker styles. That extra section is for comparison; you still need to edit the file to the intended final content. [S1]
Do the markers tell me which version is correct?
No. They identify competing content, but do not establish which change is intended. Use the surrounding context and project requirements to decide, and ask a maintainer if the purpose is unclear.
Sources
References used for this guide.
- [S1] Git - git-merge Documentation git-scm.com · Checked
