Structural Diffs With difftastic

Compare code by syntax tree so formatting changes do not drown real edits.

macOSdiffgitcliLow risk
Run difft old.ts new.ts for a syntax-aware side-by-side diff.

01Command

Command
$ difft old.ts new.ts

02What it does

difftastic parses both files with tree-sitter and highlights what actually changed in the syntax tree, so re-indentation or moved braces do not produce noisy diffs. It can also serve as git's external diff tool via GIT_EXTERNAL_DIFF=difft git diff.

03Risk

RiskLow risk
CompatibilitymacOS with Homebrew installed
!Warning: It relies on a parser for the file type; unsupported languages fall back to a plain text diff.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Homebrew formula: difftastic
    Homebrew · vendor-doc · 2026-09-20
    Evidence: Packages difftastic, which compares files by syntax structure rather than lines.

Last verified: 2026-09-22 · Category: Developer