diff-so-fancy
Improve readability of terminal diff output
TLDR
Colorize diff
Set diff-so-fancy to colorize the output during Git's interactive staging
SYNOPSIS
diff-so-fancy [options] < unified diff from stdin
PARAMETERS
-h, --help
Show help message
-v, --version
Display version information
--tabs=TABSTOP
Input tab width (default: 4)
--tabwidth=TABWIDTH
Output tab width (default: 8)
--side-by-side
Display side-by-side diff view
--left-side={old,new}
Set left side ('old' default)
--no-bold
Disable all bold formatting
--plain
Classic patch-style output (minimal color)
--ansi
Force ANSI color output
--colors-match=REGEX
Custom color regex for lines
--mark-blank-lines
Highlight blank lines with markers
DESCRIPTION
diff-so-fancy is a Perl-based utility that transforms standard unified diffs (from git diff, diff -u, etc.) into highly readable, visually appealing output.
It enhances readability by:
• Adding background colors to distinguish old/new lines (red/green backgrounds).
• Providing word-level diffs instead of line-level for precise changes.
• Using bold and other styles for headers, additions/deletions.
• Aligning changes with whitespace handling and tab expansion.
• Supporting side-by-side views.
Designed for terminal use, it's commonly piped into (git diff | diff-so-fancy) or set as Git's pager (git config core.pager 'diff-so-fancy | less --status'). Output is richly colored with 256-color support, making complex code changes easy to scan. Ideal for developers reviewing patches or pull requests in CLI environments.
CAVEATS
Perl script (requires Perl 5.10+); not in most distro repos (install via GitHub). Wide terminal recommended for side-by-side. Colors may not render in all pagers/editors.
GIT INTEGRATION
Configure as pager: git config --global core.pager 'diff-so-fancy | less --status'.
Or alias: git config alias.dff "!git diff | diff-so-fancy"
INSTALLATION
git clone https://github.com/so-fancy/diff-so-fancy.git
cd diff-so-fancy
sudo cp diff-so-fancy /usr/local/bin
chmod +x required.
HISTORY
Created in 2016 by Brian M. Carlson under so-fancy GitHub org. Gained popularity for Git workflows (~20k stars). Actively maintained with Perl refactors for performance.


