
difftastic
A diff tool that compares files by their syntax instead of by line.
- Stars
- 26.1k
- Forks
- 533
- Licence
- MIT
- Language
- Rust
- Last update
- 4 days ago
- Type
- CLI
What it is
Difftastic is a command-line tool that compares two versions of a file by their code structure rather than line by line. It highlights what actually changed, so reformatting code that splits across lines shows up as no real change. It can also be used with git and other version control systems.
- Review a git commit where code was reformatted and see only the real changes
- Check whether two source files have the same syntax using --check-only and --exit-code in a script
- View merge conflict markers in a file as two sides being diffed
- Compare JSON files after sorting keys with jq
Great for
- Developers reviewing code changes in git where reformatting adds noise
- People comparing source files in supported programming languages
- Teams who want a check that two files have the same syntax, using --check-only
- Users of editors like Emacs who want syntax-aware diffs in their workflow
Not ideal for
- People who need a patch file to apply later, because its output is for human reading only and does not generate patches
- People who need to merge branches, because it does not perform AST merging (the README points to mergiraf for that)
- People diffing very large files with many changes, because the README says it scales poorly and can use a lot of memory
- Users who need diffs of unordered data without sorting first, because it treats order as significant
How to get it
- 1
Install with a package manager
Clone the repository
git clone https://github.com/Wilfred/difftastic - 2
Run it
- Install difftastic using the instructions in the manual's installation page
- Run difft on two files, for example: difft before.js after.js
- Optionally configure git to use difftastic by following the git instructions in the manual
- 3
Get the most out of it
- Set DFT_PARSE_ERROR_LIMIT to allow a few parse errors before falling back to line diff
- Use --check-only with --exit-code to detect syntactic changes in scripts
- Use DFT_BACKGROUND=light if bright terminal colours appear grey (e.g. Solarized)
- Pass a file containing merge conflict markers as one argument to diff its two sides
Downloads
Strengths
- Understands syntax, so whitespace-only and reformatting changes are handled sensibly
- Supports over 30 programming languages according to the README
- Works with git and other version control systems, with setup instructions in the manual
Trade-offs
- The README says it can be slow and use a lot of memory on files with many changes
- Falls back to a line-oriented diff when parse errors occur, so results vary by file
- Side-by-side display can be confusing, according to the README
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| difftastic (this) | 26.1k | CLI | beginner | 4 days ago | Developers reviewing code changes in git where reformatting adds noise |
| delta | 32.6k | Dev tool | beginner | 9 days ago | Developers who read a lot of git diffs or git show output in the terminal |
| diff-so-fancy | 18.1k | CLI | beginner | 19 days ago | Developers who review many diffs in the terminal |
| ast-grep | 16.4k | CLI | beginner | 4 days ago | Developers who want grep-like searching that understands code structure |
| codebase-memory-mcp | 48k | Dev tool | intermediate | 4 days ago | Developers who use an MCP-capable AI coding agent on a large codebase |
| code-review-graph | 32.6k | Dev tool | beginner | 8 days ago | Developers who use an MCP-compatible AI coding assistant on a large repository |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.