difftastic: Compare Code by Its Syntax

Summary
Difftastic is a structural diff tool that compares source files according to their syntax instead of only comparing lines. It helps developers review code changes across formatting shifts, with line-based fallback when parsing fails.
At a glance
- Language
- Rust
- License
- MIT
- Stars
- 26k
- Forks
- 523
- Added to OSRepos
- January 28, 2026
- Last analyzed
- October 3, 2026
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Overview
Difftastic compares files by parsing their syntax, so it can show which code structures changed even when formatting or line breaks differ. This makes it useful when ordinary line-oriented diffs produce noisy results during code review.
It is a command-line tool for developers who want syntax-aware comparisons in their terminal or version-control workflows. It supports more than 30 programming languages and falls back to a line-oriented diff for unrecognized file types or, by default, when parsing encounters errors.
Key Features
- Highlights structural changes in supported programming languages.
- Handles code that has been reformatted or split across different lines.
- Distinguishes syntactically meaningful whitespace from indentation changes.
- Supports more than 30 languages, with a line-oriented fallback for unrecognized extensions.
- Integrates with Git and Mercurial workflows.
- Can compare files for syntactic changes only with
--check-only. - Can parse files containing merge-conflict markers to compare the conflicting versions.
Use Cases
- Developers reviewing refactors where code has moved or been reformatted across lines.
- Teams using Git or Mercurial that want syntax-aware diffs in their existing workflows.
- Maintainers checking whether two files differ structurally without generating a full diff.
- Developers investigating changes in files with minor parse errors, when allowing a limited number of errors is appropriate.
Project Facts
- Language: Rust
- License: MIT
- Stars: 26k
- Forks: 523
- Topics: diff, tree-sitter
- Archived: No
Getting Started
See the installation instructions in the manual for setup. After installation, compare two files with difft file1 file2. The Git integration guide explains how to use it in Git workflows.
Considerations
- Difftastic can use substantial memory and scale poorly on files with many changes.
- Its side-by-side display may be confusing in some cases.
- Parser errors can trigger a line-oriented fallback, so results may not be syntax-aware for every file.
- It produces output for people to read, not patch files for applying changes, and it does not perform AST merges.
- The repository notes that releases regularly fix crashes, so robustness is an ongoing consideration.
Source repository
Open the original repository on GitHub.
18 counted GitHub visits
Related repositories
Similar repositories that may be relevant next.

skillrank: Find and Evaluate AI-Agent Skills
October 4, 2026
SkillRank is a Rust CLI for discovering, installing, and evaluating skills used by coding agents. Its paired local evaluations compare a skill-enabled run with a control to show changes in success, tokens, time, and cost.

prime-agent: Run Self-Improving Agents for Coding Work
October 2, 2026
Prime Agent is a coding and research agent built for long-running tasks, using a persistent Python environment, recursive subagents, and durable working context. It suits developers and researchers who need agents to keep working across sessions.

SwarmLLM: Run Local and Distributed AI Models
October 2, 2026
SwarmLLM runs open AI models on your computer and can pool resources with other computers to run larger models. It also provides OpenAI- and Anthropic-compatible APIs for local apps and agents.

OpenCompany: Coordinate AI Agents to Run a One-Person Business
September 30, 2026
OpenCompany is a Rust-based host for configuring and running companies staffed by coordinated AI agents. It is aimed at solo operators who want to delegate business functions while retaining key decisions, and is explicitly not production-ready.