diff-so-fancy README

The project's README from github.com/so-fancy/diff-so-fancy. As one markdown file: README.md.

🎩 diff-so-fancy Circle CI build AppVeyor build

diff-so-fancy makes your diffs human-readable instead of machine-readable. This helps improve code quality and helps you spot defects faster.

🖼️ Screenshot

Vanilla git diff vs git and diff-so-fancy

diff-highlight vs diff-so-fancy

📦 Install

Simply copy the diff-so-fancy script from the latest Github release into your $PATH and you're done. Alternately to test development features you can clone this repo and then put the diff-so-fancy script (symlink will work) into your $PATH. The lib/ directory will need to be kept relative to the core script.

diff-so-fancy is also available from the NPM registry, brew, Fedora, in the Arch extra repo, and as ppa:aos for Debian/Ubuntu Linux.

Issues relating to packaging ("installation does not work", "version is out of date", etc.) should be directed to those packages' repositories/issue trackers where applicable.

✨ Usage

Git

Configure git to use diff-so-fancy for all diff output:

git config --global core.pager "diff-so-fancy | less --tabs=4 -RF"
git config --global interactive.diffFilter "diff-so-fancy --patch"

Diff

Use -u with diff for unified output, and pipe the output to diff-so-fancy:

diff -u file_a file_b | diff-so-fancy

We also support recursive mode with -r or --recursive

diff --recursive -u /path/folder_a /path/folder_b | diff-so-fancy

⚒️ Options

markEmptyLines

Colorize the first block of an empty line. (Default: true)

git config --bool --global diff-so-fancy.markEmptyLines false

changeHunkIndicators

Simplify Git header chunks to a human readable format. (Default: true)

git config --bool --global diff-so-fancy.changeHunkIndicators false

stripLeadingSymbols

Remove the + or - symbols at start of each diff line. (Default: true)

git config --bool --global diff-so-fancy.stripLeadingSymbols false

useUnicodeRuler

Use Unicode to draw the ruler lines. Setting this to false will use ASCII instead. (Default: true)

git config --bool --global diff-so-fancy.useUnicodeRuler false

rulerWidth

rulerWidth sets the width of the ruler lines. (Default: screen width)

git config --global diff-so-fancy.rulerWidth 80

shortHeaders

Simplify the header information to a single line for filename and line number. (Default false)

git config --global diff-so-fancy.shortHeaders true

semIntegration

Include the summary from sem in the header for each changed file. (Default false)

git config --global diff-so-fancy.semIntegration true

👨 The diff-so-fancy team

Person Role
@scottchiefbaker Project lead
@OJFord Bug triage
@GenieTim Travis OSX fixes
@AOS Debian packager
@Stevemao/@Paul Irish NPM release team

🧬 Contributing

Pull requests are quite welcome, and should target the next branch. We are also looking for any feedback or ideas on how to make diff-so-fancy even fancier.

Other documentation

🔃 Alternatives

🏛️ License

MIT

diff-so-fancy (so-fancy/diff-so-fancy)

Searching Database…

Что это такое?Утилита для командной строки, которая превращает машиночитаемый вывод diff из git в понятный человеку текст — так вы быстрее смотрите изменения и замечаете дефекты.
Это библиотека, которую я добавляю в свой проект, или утилита, которую я устанавливаю?Отдельная утилита. Вы устанавливаете один скрипт, а затем либо настраиваете git запускать его при каждом выводе diff, либо подаёте на него вывод diff прямо из терминала.
Как его установить и подключить к git?Скопируйте скрипт diff-so-fancy из последнего релиза на GitHub в свою $PATH или возьмите готовый пакет: он есть на npm, в Homebrew, Fedora, в репозитории extra у Arch и в виде ppa:aos для Debian/Ubuntu. Затем настройте git использовать его для всего вывода diff.
Нужно ли что-то ещё, кроме git, чтобы он работал?Он написан на Perl, поэтому на машине нужен интерпретатор Perl, плюс git для обычной работы с diff.
Есть ли подводные камни при установке?Если вы клонируете репозиторий для разработки, а не берёте релиз, каталог lib/ должен лежать рядом с главным скриптом. Проблемы с пакетами npm или из дистрибутивов нужно сообщать в багтрекеры самих этих пакетов, а не в этот репозиторий.
Он будет работать на Windows или это только для Mac и Linux?Это переносимый скрипт, который работает везде, где есть Perl и git: в README упомянуты brew для macOS, Fedora, Arch и PPA для Debian/Ubuntu, а пакет npm работает кроссплатформенно, включая Windows.
Что конкретно меняется в том, как выглядит diff?Заголовки блоков git становятся упрощёнными и понятными человеку, первый блок пустых строк подсвечивается цветом, а символы + и - в начале строк можно убрать. Заголовки могут сжиматься до одной строки только с именем файла и номером строки, и утилита рисует линейку из Unicode-символов, подогнанную под ширину экрана. Всё это — опции: markEmptyLines, changeHunkIndicators, stripLeadingSymbols, useUnicodeRuler, rulerWidth, shortHeaders, semIntegration — у каждой есть разумные значения по умолчанию.
А можно пользоваться им без git, с обычным выводом diff?Да — запустите diff с флагом -u для unified-вывода и передайте результат в diff-so-fancy. Поддерживается и рекурсивный режим: через -r или --recursive.
Чем он отличается от Delta или difftastic?В README в качестве альтернатив названы Delta, difftastic и Lazygit. Lazygit даже поставляется со встроенной поддержкой diff-so-fancy, так что вы можете получить такой же читаемый вывод внутри этого терминального интерфейса, не выбирая между ними.
Creator
so-fancy
Size
0.8 MB
Stars
18.1K
Age
10y
Commits · 90 Days