Syntax-aware merge driver for resolving Git conflicts structurally across supported code and config formats.
$cargo install --locked mergiraf
AI Analysis
Mergiraf is a syntax-aware merge driver for resolving version-control conflicts in supported code and data files. It is designed to plug into Git directly and is also documented for Jujutsu workflows through jj resolve --tool mergiraf.
What It Enables
- Register as a Git merge driver so merges, rebases, cherry-picks, and reverts can auto-resolve supported files structurally instead of falling back immediately to plain text conflicts.
- Run
mergiraf solveon an already conflicted file to rewrite it with fewer or narrower conflict markers, or print the attempted resolution to stdout. - List supported languages, compare Mergiraf's result against a line-based merge with
review, and package a failing merge into a reproducible zip viareport.
Agent Fit
- Commands operate on explicit files, return meaningful exit codes, and can run non-interactively inside merge, rebase, or CI workflows.
- The automation surface is narrow and text-first: there is no JSON output, no remote repository inspection, and most outputs are rewritten files, diffs, or logs.
- Best used as a focused primitive inside Git or Jujutsu conflict-resolution flows rather than as a general replacement for tools like
gitorjj.
Caveats
- Best results depend on supported languages and
diff3conflict style; unknown or unparsable files fall back to line-based merging. - Jujutsu users should invoke it through
jj resolve --tool mergiraf;mergiraf solvedoes not understand Jujutsu's native conflict marker format.