easy-conflict is a terminal native Git mergetool with a 3 pane IntelliJ like resolver. It focuses on conflict blocks and writes the resolved result back to the merged file.
- 3 pane TUI with ours, result, and theirs
- Diff3 base view when available via git merge-file
- No args mode that lists conflicted files and lets you pick one
- Non interactive modes for CI or scripts
- Optional backup of the merged file
Option 1. Go install
go install github.com/chojs23/ec/cmd/ec@latest
Option 2. Install script
./scripts/install.sh
PREFIX=/usr/local ./scripts/install.sh
Option 3. Build from source
make build
- Run with no args inside a git repo that has conflicts
ec
- Use it as a mergetool
git mergetool --tool ec
This repo includes a minimal Neovim plugin that opens ec in a terminal buffer.
Install with your plugin manager and ensure ec is on your PATH.
Minimal config:
require("ec").setup()Lazy.nvim minimal config:
{
"chojs23/ec",
keys = {
{ "<leader>gr", ":Ec<CR>", desc = "Open ec" },
},
}Default config
Config defaults:
{
cmd = "ec",
open_cmd = "tabnew",
cwd = nil,
float = true,
close_on_exit = true,
}Option notes:
cmd: executable name or list with default args;:Ecargs are appended.open_cmd: Vim command used when float is disabled or unavailable.cwd: working directory for ec; string path or function; defaults togetcwd().float: enable floating window; table merges with float defaults.close_on_exit: close terminal on successful exit code 0.
Float defaults when float = true:
{
width = 0.92,
height = 0.86,
border = "rounded",
title = "ec",
title_pos = "center",
zindex = 50,
}Float option notes:
widthandheight: fractions of editor when <= 1, otherwise absolute size.border: floating window border style.title: title text for the float.title_pos: title alignment.zindex: float stacking order.
Usage:
:Ec
:Ec --base <path> --local <path> --remote <path> --merged <path>
Add this to your git config
[merge]
tool = ec
[mergetool "ec"]
cmd = ec "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
trustExitCode = true
Notes
- ec does not run git add after you write
- Git will still decide whether the merge is resolved based on the file contents
Interactive
ec <BASE> <LOCAL> <REMOTE> <MERGED>
ec --base <path> --local <path> --remote <path> --merged <path>
No args mode
ec
Non interactive
ec --check --merged <path>
ec --apply-all ours --base <path> --local <path> --remote <path> --merged <path>
The resolver shows three panes in one view.
Conflicts are shown as focused blocks. The center pane is the output that will be written to the merged file.
You can move between conflicts, choose a side, and apply it. The status line shows which conflict you are on and whether it is resolved.
Use e to open $EDITOR with the current result. When you exit the editor, the resolver reloads the merged file and keeps manual edits.
Blue: modified lines (changed vs base)
Green: added lines
Red: conflicted lines where both sides differ
Keybindings are vim-like by default.
- n / p: next and previous conflict
- j / k: vertical scroll
- H / L: horizontal scroll
- h / l: select ours or theirs
- a: accept selection
- d: discard selection
- o, t, b, x: apply ours, theirs, both, or none
- O and T: apply ours or theirs to all
- u: undo
- e: open $EDITOR with current result
- w: write file without quitting
- q: back to selector or quit
Backups are off by default. Use --backup to write a sibling file named .ec.bak before writing the result.
Base chunks come from git merge-file --diff3 output. If the base stage is missing for a file, the tool continues without a base view and prints a warning.
MIT
