ConfigsApr 15, 2026·2 min read

diff-so-fancy — Good-Looking Diffs for git and plain text

diff-so-fancy strips filenames, strips leading `+/-`, highlights word-level changes, and turns ugly unified diffs into clean, GitHub-style readable output — a drop-in replacement for git's default diff.

Introduction

diff-so-fancy post-processes git's diff output to collapse filename headers, colorize hunk ranges, highlight intra-line word changes, and trim the leading +/- columns. It's written in Perl (now with a pre-built Node distribution) and reads from stdin, so it composes with any git or plain diff pipeline.

What diff-so-fancy Does

  • Rewrites git-style unified diffs into a condensed, readable layout.
  • Highlights word-level changes in a line.
  • Strips the leading plus/minus gutter so code selects cleanly.
  • Integrates as git's core.pager or interactive.diffFilter.
  • Works with any tool that emits unified diff (svn, diff -u).

Architecture Overview

diff-so-fancy is a filter: it reads diff stdin, runs a line-by-line state machine distinguishing meta/hunk/added/removed/unchanged lines, applies ANSI color codes, and writes to stdout. Word highlighting uses git diff-highlight internally (bundled).

Self-Hosting & Configuration

  • Install via brew, apt, pacman, or npm install -g diff-so-fancy.
  • Configure via git config — see Quick Use above.
  • --patch mode strips color for pager-pickers like fzf.
  • Pair with less -RFX to keep colors and quit on short diffs.

Key Features

  • Drastically cleaner reviews — filename only at top of section.
  • Word-level diff highlight.
  • Zero config beyond git config.
  • Works with GitHub CLI (gh pr diff | diff-so-fancy).
  • Fast — Perl/Node pipe, negligible overhead.

Comparison with Similar Tools

  • delta (dandavison) — Rust, more features (syntax-highlight, side-by-side).
  • git diff-highlight — built-in; word highlights but less polished.
  • icdiff — side-by-side Python tool.
  • git --word-diff — built-in word diff; less pretty.
  • meld/kdiff3 — GUI tools for three-way merges.

FAQ

Q: Which is "better", delta or diff-so-fancy? A: delta is more featureful; diff-so-fancy is lighter and works everywhere Perl/Node does.

Q: Does it support side-by-side? A: No — stick with delta or icdiff for that.

Q: Broken with less? A: Use less --tabs=4 -RFX as shown.

Q: Can I disable word highlighting? A: diff-so-fancy --colors="keepEmptyLines,stripLeadingSymbols".

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets