Structural Diffs With difftastic
Compare code by syntax tree so formatting changes do not drown real edits.
Run difft old.ts new.ts for a syntax-aware side-by-side diff.
01Command
Command
$ difft old.ts new.ts02What 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
!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: difftasticEvidence: Packages difftastic, which compares files by syntax structure rather than lines.
Last verified: 2026-09-22 · Category: Developer