Last updated
Basic Two-Branch Merge Conflict
When two developers edit the same line in different branches, Git marks the conflict like this:
<<<<<<< HEAD
const timeout = 3000;
=======
const timeout = 5000;
>>>>>>> feature/increase-timeout
Paste this into the Merge Conflict Resolver. The tool shows your version (3000) on the left and the incoming version (5000) on the right. Click "Accept Incoming" to keep 5000, or manually type the value you want in the merged output panel.
Resolving a Function Body Conflict
Two branches modified the same function differently:
<<<<<<< HEAD
function greet(name) {
return "Hello, " + name;
}
=======
function greet(name, title) {
return "Hello, " + title + " " + name;
}
>>>>>>> feature/add-title
The three-way view shows the common ancestor had no title parameter. You decide to keep both changes by combining them:
function greet(name, title = "") {
return title ? "Hello, " + title + " " + name : "Hello, " + name;
}
Use the manual edit panel to type this combined resolution, then mark the conflict as resolved.
Multiple Conflicts in One File
A configuration file with three separate conflicts:
<<<<<<< HEAD
DB_HOST=localhost
=======
DB_HOST=db.production.com
>>>>>>> main
<<<<<<< HEAD
DB_PORT=5432
=======
DB_PORT=5433
>>>>>>> main
<<<<<<< HEAD
LOG_LEVEL=debug
=======
LOG_LEVEL=info
>>>>>>> main
The conflict navigator shows "3 conflicts remaining." Use the Next/Previous buttons to jump between them. Resolve each one in sequence — the progress bar updates as you go. When all three are resolved, the output is a clean file with no conflict markers.
Whitespace-Only Conflict
Sometimes conflicts differ only in indentation or line endings:
<<<<<<< HEAD
return result;
=======
return result;
>>>>>>> feature/reformat
The tool flags this as a whitespace-only conflict. You can safely accept either version — choose "Accept Yours" to keep 4-space indentation or "Accept Incoming" to switch to 2-space. These are resolved in seconds without careful code review.
Conflict from a Git Rebase
During git rebase main, a commit that added error handling conflicts with a refactor on main:
<<<<<<< HEAD (main)
async function fetchData(url) {
const res = await fetch(url);
return res.json();
}
=======
async function fetchData(url) {
try {
const res = await fetch(url);
if (!res.ok) throw new Error(res.status);
return res.json();
} catch (e) {
console.error(e);
return null;
}
}
>>>>>>> feature/error-handling
The three-way view shows the ancestor had no try/catch. The incoming version adds proper error handling. Accept the incoming version — it is strictly better than the current HEAD version.
Conflict in a JSON Configuration File
Two branches both updated package.json dependencies:
<<<<<<< HEAD
"dependencies": {
"express": "^4.18.0",
"lodash": "^4.17.21"
}
=======
"dependencies": {
"express": "^4.18.2",
"axios": "^1.4.0"
}
>>>>>>> feature/add-axios
Neither version is complete — yours has lodash, theirs has axios and a newer express. Use the manual editor to combine them:
"dependencies": {
"express": "^4.18.2",
"lodash": "^4.17.21",
"axios": "^1.4.0"
}
Cherry-Pick Conflict Resolution
After running git cherry-pick abc1234, a conflict appears in a CSS file:
<<<<<<< HEAD
.button {
background: #007bff;
border-radius: 4px;
}
=======
.button {
background: #0056b3;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
>>>>>>> abc1234
The cherry-picked commit updated the button style. Accept the incoming version to apply the new design, or use "Accept Both" to merge properties if needed.
Conflict Resolution Workflow
Here is the full workflow for using the tool with your git repository:
- Run
git merge feature-branch— Git reports conflicts and stops - Open the conflicted file and copy its entire contents (conflict markers included)
- Paste into the Merge Conflict Resolver
- Resolve each conflict using the visual interface
- Copy the resolved output
- Replace the conflicted file contents with the resolved output
- Run
git add <file>thengit committo complete the merge
Understanding the Three-Way View
The three panels in the resolver represent:
- Left panel — your current branch (HEAD)
- Center panel — the common ancestor (the commit both branches diverged from)
- Right panel — the incoming branch being merged
Seeing the ancestor helps you understand what each branch changed. If both branches changed the same line from the ancestor, you have a true conflict. If only one branch changed it, that change should usually win automatically.
Avoiding Conflicts in the Future
The tool's documentation recommends these practices to reduce merge conflicts:
- Keep feature branches short-lived — merge back to main frequently
- Communicate with teammates before editing shared files
- Run
git pull --rebaseregularly to stay current with main - Break large files into smaller modules to reduce overlap
- Use consistent code formatting tools so whitespace conflicts do not occur
When conflicts do occur, the visual resolver makes them fast to fix — even complex multi-conflict files can be resolved in minutes with the navigation and syntax highlighting features.