To use diff3 in Git, enable the diff3 conflict style, then compare the current change and incoming change with the common ancestor’s text. Edit each conflicted passage into the intended final content, remove its markers, stage the file, and finish or continue the merge. diff3 adds context; it does not choose the resolution for you.
Enable diff3 conflict markers
Git’s merge.conflictStyle setting controls how it formats conflicted sections in working-tree files. Set it globally to use diff3 in repositories for your user account:
git config --global merge.conflictStyle diff3
To apply the preference only to the current repository, run the same command there without --global:
git config merge.conflictStyle diff3
Git documents this setting and the available conflict styles in its git-merge documentation; the Pro Git advanced merging chapter also demonstrates configuring diff3.
#1 Best Overall
Read a diff3 conflict block
After a merge produces conflicts, open an affected file. A diff3-style block has four markers that divide the passage into three versions:
<<<<<<<begins the current side’s version.|||||||begins the common ancestor’s original text.=======separates the base text from the incoming side’s version.>>>>>>>ends the block after the incoming side’s version.
The text between the opening marker and the base marker is the current side; the text between the separator and the closing marker is the incoming side. The base section is not a fourth option or “theirs”—it shows what the two sides started from. Marker labels can vary with the merge operation and Git version, so use their positions and roles to interpret the block.
Rank #2
Edit the conflict into the intended result
- Compare both changed versions with the base text to understand what each side changed.
- Edit the whole conflicted block into the final content the project should contain. You may keep one side, combine parts of both, or write a different result.
- Delete all conflict markers and any unwanted alternative text. Save the file, then inspect it to confirm the result reads or works as intended.
Repeat for every conflicted passage and file. Once a file is resolved, stage it:
git add path/to/file
After staging all resolved files, finish the merge with git commit. If Git reports that a merge is in progress and needs to be completed, use git merge --continue. To abandon an in-progress merge instead, Git documents git merge --abort.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchHow diff3 compares with merge and zdiff3
| Style | What appears in a conflict | Trade-off |
|---|---|---|
merge |
Current and incoming versions, separated by =======; no base section. |
Often produces smaller conflict regions, but provides less context about the original text. |
diff3 |
Current and incoming versions plus the common-base text under |||||||. |
Makes it easier to see how both sides changed the original passage, though conflict blocks can be larger. |
zdiff3 |
Like diff3, with matching lines near the beginning or end of a conflict region removed from the region. | Retains base context while trimming some boundary-line bulk. |
These styles affect the conflict text Git writes; none determines the correct final content. Git describes their formatting and trade-offs in its merge documentation.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When to use a merge tool
You can resolve markers directly in an editor; a separate merge utility is optional. Git’s git mergetool command can launch a configured utility, either for all conflicted files or for selected paths. Git lists tools such as KDiff3 and Meld in its git-mergetool documentation. A tool can present the competing versions visually, but you still need to choose and verify the intended result.
Quick Recap
Best Value
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.




