Skip to content
Conflict Resolution — Explained with Examples

Conflict Resolution — Explained with Examples

DodaTech Updated Jun 15, 2026 2 min read

Conflict resolution handles competing changes from different branches that Git cannot automatically merge, requiring manual intervention to reconcile.

Merge conflicts occur when two branches modify the same part of a file in different ways. Git marks the conflicting area with conflict markers (<<<<<<<, =======, >>>>>>>), showing both versions. You must edit the file to resolve the conflict, remove the markers, stage the resolved file, and complete the merge. Merge tools like git mergetool provide visual interfaces for resolution.

Think of conflict resolution like two chefs seasoning the same dish differently. One adds salt, the other adds pepper. The head chef (you) must taste the dish and decide whether to keep salt, pepper, both, or neither — then plate it (commit).

Conflicts arise most often when working on shared files, long-lived branches, or poorly coordinated teams. Frequent merging and small, focused commits reduce conflict frequency.

# Attempt a merge that produces a conflict
git merge feature/redesign
# CONFLICT (content): Merge conflict in index.html

# View the conflict
cat index.html
# <<<<<<< HEAD
# <h1>Welcome</h1>
# =======
# <h1>Welcome to our site</h1>
# >>>>>>> feature/redesign

# After editing to resolve...
git add index.html
git commit -m "Resolve merge conflict in index.html"

Preventive strategies include communicating about who works on what, rebasing often to keep branches up to date, and using merge constraint tools like .gitattributes with merge drivers.

Merge, Rebase, Git, Branch

Merge Guide

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro