Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

How to Fix Git Diff3 Conflicts When Comparing Files

Git diff3 markers show two conflicting edits and their common ancestor. Learn how to resolve the file, finish or abort the merge, and configure future conflicts.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If you see <<<<<<<, |||||||, ======= and >>>>>>> inside a file, Git has marked a merge conflict; those lines are not a separate diff3 error. Edit the file to keep the intended final content, remove every marker, stage the file with git add, and finish or abort the merge. The ||||||| section shows the common ancestor so you can understand what changed; it is not a third version you must copy into the result.

First identify which “diff3 error” you have

In Git, diff3 is a conflict-marker style that adds the earlier shared version of the text to a conflict block. If those marker lines appear in a file, follow the Git resolution steps below. If a standalone comparison or merge program instead prints an error, the fix depends on that program: the command you ran and the complete error message are needed to diagnose it responsibly. GNU diff3 documentation describes a separate tool that merges two changed versions against a common ancestor.

How to resolve a Git diff3 conflict

1. Read the three versions in the conflict

A typical diff3-style block looks like this:

<<<<<<< HEAD
current-side version
||||||| base
common-ancestor version
=======
other-side version
>>>>>>> incoming-branch

The labels vary by Git operation and may show branch names or file paths. The text above ||||||| is the current side; the text between ||||||| and ======= is the common ancestor; the text between ======= and >>>>>>> is the other side. Compare both sets of edits with the base to see what each changed.

2. Decide what the file should contain

Git marks a conflict when overlapping edits prevent it from safely choosing a result. Keep one side, combine the edits, or rewrite that section—whichever produces the behavior the project needs. Do not automatically choose “ours” or “theirs”: either choice can discard the other side’s work. The base is context for making that decision, not a candidate section to retain by default.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Remove the markers and inspect the result

Edit the file so it contains only the intended final content. Remove the marker lines and any unwanted versions of the conflicted text. Then inspect the surrounding code or prose to catch accidental deletions, duplicated content, or broken syntax. Check for remaining markers before staging; a conflict marker left in source code can be committed as literal text.

4. Stage the resolved file and complete the merge

  1. Stage the resolved path: git add <path>.
  2. If Git is waiting for a merge commit, finish the merge with git commit and complete or edit the commit message as prompted.

If you want to abandon an in-progress merge rather than resolve it, run git merge --abort. This is for cancelling the merge, not for keeping your edits and marking the conflict resolved.

What Git’s conflict styles change

The merge.conflictStyle setting controls the context Git writes into future conflict hunks; it does not resolve an existing conflict for you.

Style What appears in a conflict Practical trade-off
merge The two conflicting sides. Git’s versioned manual says this style tends to produce smaller conflict regions than diff3.
diff3 The two sides plus the common-ancestor text. The base can make it easier to understand how the sides diverged, at the cost of extra context in the hunk.
zdiff3 The two sides plus base context, with matching lines near conflict boundaries trimmed. Availability depends on the installed Git version; check local documentation if Git rejects the value.

Git documents these styles in its merge configuration manual and its versioned git-merge manual. None of them decides which content is correct; you still need to resolve and stage the file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose diff3 for future conflicts

To enable base context for one repository, run this from that repository:

git config merge.conflictStyle diff3

To set it for your user account across repositories, run:

git config --global merge.conflictStyle diff3

To try the related zdiff3 style, substitute zdiff3 for diff3. If Git reports that the value is invalid or unsupported, check git --version and the manual for that installation rather than assuming every version supports it.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

If you need to recreate the conflict markers

When markers are missing from a conflicted path, Pro Git’s Advanced Merging chapter shows the version-sensitive example git checkout --conflict=diff3 <path>. Because command forms can differ across Git versions, consult git help checkout for your installed version before using it. Recreating the conflict display does not make the resolution decision; review the resulting hunk and edit it as usual.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.