Mergiraf is a syntax-aware merge conflict resolver for Git that uses abstract syntax trees instead of line-based merging. Built in Rust with tree-sitter parsing library, it supports 33 programming languages and can automatically resolve conflicts that Git's default algorithm cannot handle, such as when two developers modify different parts of the same line (e.g., changing a function's return type versus its parameter type). Testing on Linux kernel history showed it successfully resolved 428 out of 7,415 merge conflicts that would have required manual intervention. The tool works by performing line-based merging first, then applying tree-based algorithms only to conflicting regions, using language-specific knowledge like commutative parents to intelligently merge code while maintaining semantic correctness.
Sort: