Wilfred

difftastic: Compare Code by Its Syntax

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.

View on GitHub Compare
Stars
26k
Forks
523
Stars, last 30 days
+169

Our take

Health score

65/100

How it is scored
Activity
70
Community
90
Issues
53
Pull requests
47

+169 stars in the last 30 days

  • More contributors than 78% of the projects we track

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

26,199

Forks

540

Change since Nov 17, 2026: +9 stars·+1 forks

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.

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.

Found this useful?

Share it with someone who would like difftastic.