What is difftastic?
difftastic (the command is difft) is a structural diff tool. Instead of comparing lines, it parses both files with tree-sitter, builds a syntax tree for each side and reports which pieces of syntax actually changed. Reindenting a block, rewrapping an argument list or moving a closing brace stops being a diff, while a renamed variable buried in reformatted code stands out.
⚡ Key Features of difftastic
🌳 Syntax-Aware Diffs
Both sides are parsed into syntax trees and compared as structure, so formatting churn disappears and real changes stand out.
🧩 Over 30 Languages
Rust, Python, TypeScript, Go, C, C++, Java, Ruby, YAML, JSON, HTML, CSS, Markdown and many more, difft --list-languages prints the full list with extensions.
🪟 Side-by-Side or Inline
--display picks side-by-side, side-by-side-show-both, inline, or machine-readable JSON for tooling.
🔗 Drop-in for Git
Works as an external diff command for git, and just as well for Mercurial, Jujutsu and Fossil.
🚦 Honest Fallback
An unknown extension, an enormous file or too many parse errors falls back to a line-oriented diff with word-level highlighting instead of failing.
🗂️ Directories and Conflicts
Diff two directories in one command, or hand difftastic a file full of merge-conflict markers and read the conflict as a diff.
apt upgrade keeps you on the latest version.
📦 Installation from deb.griffo.io
Step 1: Add Repository
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null
sudo apt updateinstall -d -m 0755 /etc/apt/keyrings
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null
apt update🆓 There is an always-free mirror. deb-free.griffo.io serves packages free forever, no account, no subscription, at most 2 months behind upstream, security fixes immediately. It currently carries cliamp, Ghostty, lazydocker, Oh My Posh and Zed; difftastic is not one of them, so the repository above is the only way to get it today, ask and it can be enrolled.
Step 2: Install difftastic
# Install latest difftastic
sudo apt install difftastic
# Verify installation
difft --version# Install latest difftastic
apt install difftastic
# Verify installation
difft --versionStep 3: Wire it into git
# Compare two files directly
difft old.py new.py
# Or let git call difftastic for every diff
git config --global diff.external difft
# The plain git diff is still one flag away
git --no-ext-diff diff
# The manual page ships with the package
man difft🎯 Basic Usage Examples
Comparing files and directories:
# Two files, side by side
difft before.rs after.rs
# A single column, closer to traditional diff output
difft --display inline before.ts after.ts
# Two directories, skipping files that did not change
difft old/ new/ --skip-unchanged --sort-paths
# Which languages does this build understand?
difft --list-languagesUsing it as git's diff:
# One-off: difftastic for this diff only
GIT_EXTERNAL_DIFF=difft git diff
# Structural diffs through the whole history
GIT_EXTERNAL_DIFF=difft git log -p --ext-diff
# Register it as a difftool
git config --global difftool.difftastic.cmd 'difft "$LOCAL" "$REMOTE"'
git difftool --tool difftastic
# A git alias for a structural log
git config --global alias.dlog '!GIT_EXTERNAL_DIFF=difft git log -p --ext-diff'Tuning the output:
# Ignore comment-only changes
difft --ignore-comments a.go b.go
# More context, and tabs worth two spaces
difft --context 5 --tab-width 2 a.py b.py
# For scripts: is there a syntactic change at all?
difft --check-only --exit-code a.json b.json
# Defaults for every invocation, from the environment
export DFT_DISPLAY=inline DFT_BACKGROUND=light🔧 Tool Integrations
difftastic plugs into the tools that already show you diffs:
- git:
GIT_EXTERNAL_DIFF,diff.externalor adifftoolentry,--ext-diffextends it togit log -pandgit show - Jujutsu: set it as the diff command in
jjand get structural diffs in a Git-compatible workflow - Mercurial and Fossil: both accept an external diff command, so the same binary serves every repository you have
- Environment variables:
DFT_DISPLAY,DFT_BACKGROUND,DFT_WIDTHand friends set your defaults once - CI and scripts:
--check-onlywith--exit-codeanswers "did the syntax change?" without printing the diff, and--display jsonis made for parsing
🚀 Why Choose deb.griffo.io?
- Official Ubuntu: does not package difftastic at all, a stock system has nothing to install
- cargo install difftastic: current, but it is a long compile with a lot of tree-sitter grammars, and it lands outside apt with no man page
- Upstream tarball: the official binary, re-downloaded by hand for every release
- deb.griffo.io: latest version with automatic updates
- ✅ Current Grammars: the newest release, with tree-sitter grammars that understand the language versions you are writing today
- ✅ The Only apt Source: difftastic is in neither the Debian nor the Ubuntu archives; this repository packages the official upstream build
- ✅ Automatic Updates: packages updated within hours of upstream releases
- ✅ Complete Package: the upstream binary as
/usr/bin/difftplus thedifft.1man page - ✅ Two Architectures: amd64 (a static musl build, no library dependencies) and arm64
- ✅ Multi-Distribution: works on Ubuntu 22.04, 24.04, 25.10 and 26.04
- ✅ Easy Maintenance: standard apt commands for updates
📦 Package Build Repository
The Ubuntu packages are automatically built and maintained in this GitHub repository:
- 🔀 difftastic-debian - Latest release builds
🔗 Related Packages
Also available from deb.griffo.io:
- lazygit - Terminal git UI for staging hunks and lines
- Jujutsu - Git-compatible VCS with first-class rebases
- ripgrep - Fast recursive search across the same tree
- Neovim - Editor to open whatever the diff pointed at
💝 Support This Project
If this repository saves you time and effort, please consider supporting it!