Subscribe
0%
Illustration for: OmniDiff is a fast Rust difftool that understands code in 25 languages, plus images, fonts, PDFs and archives

OmniDiff is a fast Rust difftool that understands code in 25 languages, plus images, fonts, PDFs and archives

OmniDiff, an AGPL-licensed terminal diff tool, parses your code to show what changed instead of which lines moved. It can also compare pictures, fonts and the members of an archive. Version 0.3.0 shipped November 1 and drew more than 300 points on Hacker News. Its speed numbers are impressive, but its own README says accuracy targets aren't met yet.

Listen to this article0:00 / 4:38
ivankovic/omnidiff

Content-aware diffing for code (25 tree-sitter languages), images, archives, fonts and PDFs, in the terminal.

Language
Rust
License
AGPL-3.0-only
Try it
cargo install --locked omnidiff
View on GitHub

OmniDiff is a free, open-source diff tool from developer Marko Ivankovic. It's written in Rust and runs in the terminal. Plain diff compares files line by line. OmniDiff instead picks a comparison method for each file type: it parses source code with tree-sitter grammars, compares images pixel by pixel, and opens archives and PDFs to say which pieces changed. Version 0.3.0 was released on November 1. Its Show HN post had 319 points and 105 comments when we read it.

Why it matters: most of us still review changes with diffs that mark a whole line deleted and re-added when only one argument changed. For binary files like a font, a PDF or a zipped Office document, git diff just reports "Binary files differ." OmniDiff aims to fix both problems in one tool you can drop into git difftool.

What it handles

According to the project README:

Kind of file How OmniDiff compares it
Code in 25 languages (C, C++, C#, Go, Java, JavaScript/TypeScript/TSX, Python, Rust, Ruby, PHP, Swift, Kotlin, Bash, YAML, JSON, XML and more) Structurally, via tree-sitter, highlighting only the changed parts
Markdown, SQL, Protobuf, Dart, Bazel, Emacs Lisp Recognized, diffed as plain text
Images (PNG, JPEG, GIF, WebP, BMP, ICO, TIFF) By pixel, including frame-by-frame for animated GIF/PNG/WebP
Archives (zip, including jar, EPUB and Office files; tar, gzip, xz, bzip2) Member by member
Fonts (TTF, OTF, WOFF/WOFF2, EOT), cursor themes, gettext/Qt message catalogs, PDFs By content

The v0.3.0 release adds two refinements. Code embedded inside strings, such as TSX, shell or CSS, is now diffed as that language. CSS class lists are compared class by class. The notes also claim diffs are about 22% faster on average, and the release updates the zip and libz-sys dependencies for security fixes. It's a young project: the releases page shows v0.0.10 on August 24 and the first "ready for users" v0.1.0 on September 25.

Try it

# Rust toolchain (needs rustc 1.92+ and a C compiler)
cargo install --locked omnidiff

# or Homebrew
brew install ivankovic/omnidiff/omnidiff

# use it as a git difftool
git config difftool.omnidiff.cmd 'omnidiff "$LOCAL" "$REMOTE"'
git difftool --tool=omnidiff

The README also lists a signed apt repository for Debian and Ubuntu, a Nix flake (nix run github:ivankovic/omnidiff), an Arch PKGBUILD, a Gentoo ebuild and prebuilt binaries for Linux, macOS and Windows. MacPorts already has a 0.3.0 port. Inside the viewer, press ? for the keybindings. Hacker News commenters said the side-by-side view (the v key) was easy to miss.

The numbers, and the caveats

The README's benchmark ran 2,302 test fixtures on an Intel Core i7-1370P laptop. It reports a median of 4.2 ms per diff, 35.1 ms at the 90th percentile and 177 ms at the 99th, with the slowest case at 482 ms. For robustness, it says 99.95% of about 442,000 real before-and-after code pairs completed without failing.

Accuracy is the weak spot, and the project says so itself. The README sets a goal of 90% of test cases with zero mismatched bytes. It states that the goal is not yet met: it reports 60.0% in --full mode and 69.6% in --minimal. In the HN thread, the author put OmniDiff at 90% "perfect" against 64% for Difftastic. One commenter asked for reproducible evidence after seeing little difference in their own tests, and the author acknowledged the research is incomplete. The author also said the tool can crash on degenerate inputs, such as huge byte arrays in C++ headers, because of a stack overflow in tree-sitter.

Other things to know before adopting it:

  • License: OmniDiff is AGPL-3.0-only, with a paid commercial license offered through GitHub Sponsors. That's fine for using it on your machine, but companies that want to embed it should read the terms. Several HN commenters argued the license will slow adoption, and the author called it a deliberate choice.
  • Single files only, for now: Cross-file move detection and three-way merge aren't supported. The author described the former as on the roadmap and the latter as a long-term goal.
  • AI disclosure: The author says AI tools were used in development but that the code is not "vibecoded."

Who should try it

Try it if you review a lot of refactors, work in a polyglot repo, or regularly diff assets like icons, fonts or packaged documents. It's a quick install and easy to remove. If you mostly want prettier line diffs in git log -p, tools like Delta are simpler to set up. Treat OmniDiff's accuracy claims as early until independent comparisons appear.

Sources

  1. GitHub — ivankovic/omnidiff releases github.com
  2. docs.rs — omnidiff README docs.rs
  3. Hacker News — Show HN: OmniDiff, open-source, content-aware Git difftool in Rust hn.jakechampion.name
  4. MacPorts — omnidiff port ports.macports.org

#open source#Rust#git#diff#developer tools#tree-sitter#OmniDiff