diff-so-fancy

Perl script that reformats git diff and unified diff output for readability, with cleaner headers, hunk markers, and stripped +/- symbols.

diff-so-fancy is a diff post-processor. It reads unified diff output, either from git or from the standard diff -u command, and reformats it to be easier to read. It is used as a pager filter for git, or at the end of a pipe such as diff -u file_a file_b | diff-so-fancy. Recursive diffs are supported too: diff --recursive -u /path/folder_a /path/folder_b | diff-so-fancy.

For git, you set it as the core pager with git config --global core.pager "diff-so-fancy | less --tabs=4 -RF". You can also set it as the interactive diff filter with git config --global interactive.diffFilter "diff-so-fancy --patch". The output simplifies git's hunk header chunks, draws ruler lines around file names, can remove the leading + and - symbols, and colorizes the first block of empty lines.

Behavior is controlled through git config keys under the diff-so-fancy. namespace. These are markEmptyLines, changeHunkIndicators, stripLeadingSymbols, useUnicodeRuler, rulerWidth, fileNameRulerShape, shortHeaders and semIntegration. shortHeaders collapses the file name and line number into a single line. semIntegration adds the summary from the sem tool to the header of each changed file. The README lists Delta, difftastic, and Lazygit (which has a diff-so-fancy integration) as related tools. The tool is aimed at developers who read diffs in the terminal.

diff-highlight vs diff-so-fancy

Alternatives & related tools

add a badge to your README

Maintain diff-so-fancy? Show that it's featured on trmn. The badge links back to this page.

Featured on trmn
Markdown
[![Featured on trmn](https://www.trmn.sh/badge/diff-so-fancy.svg)](https://www.trmn.sh/tools/diff-so-fancy?utm_source=badge)
HTML
<a href="https://www.trmn.sh/tools/diff-so-fancy?utm_source=badge"><img src="https://www.trmn.sh/badge/diff-so-fancy.svg" alt="Featured on trmn" height="20"></a>