| Crates.io | riffdiff |
| lib.rs | riffdiff |
| version | 3.4.1 |
| created_at | 2022-07-21 12:21:06.795535+00 |
| updated_at | 2025-08-12 19:42:50.990971+00 |
| description | A diff filter highlighting changed line parts |
| homepage | https://github.com/walles/riff/#readme |
| repository | https://github.com/walles/riff/ |
| max_upload_size | |
| id | 629606 |
| size | 5,257,011 |
Riff is a wrapper around diff that highlights which parts of lines have changed.

Unchanged parts of changed lines are shown in yellow.
riff also helpfully highlights conflicts and merge commits.
Much like git, Riff sends its output to a pager, trying these in order:
$PAGER environment variableless because it is ubiquitousgit diff | riff
Or if you do...
git config --global pager.diff riff
git config --global pager.show riff
git config --global pager.log riff
git config --global interactive.diffFilter "riff --color=on"
... then all future git diff, git show and git log --patch output will be
refined.
Or you can use riff as an alias for diff:
riff file1.txt file2.txt
You can configure riff by setting the RIFF environment variable to one or
more (space separated) command line options.
For example, set RIFF=--no-adds-only-special to disable adds-only special
highlighting.
brew install riff
paru -S riffdiff
cargo install riffdiff
Go here and download the correct binary for your platform
chmod a+x riff-*
mv riff-* /usr/local/bin/riff
Optionally followed by this to have riff highlight git output by default:
git config --global pager.diff riff
git config --global pager.show riff
git config --global pager.log riff
git config --global interactive.diffFilter "riff --color=on"
This VSCode extension for improved Git commit message editing is nice. Yes, I wrote it and I'm tooting my own horn here.
Good choice if you (like me!) are using VSCode for Git commit message editing.
riff can highlight conflict markers created by git:

riff highlighting a git merge commits highlighting

If you put example input and output in the testdata directory, then cargo test will verify that they match.
On mismatches, you can run testdata-examples.sh to compare current output to
the expected output for all examples, and optionally update expectations.
Invoke ci.sh to run the same thing as CI.
Invoke benchmark.py to get numbers for how fast your current source code is
versus earlier releases.
Invoke git log -p | cargo run -- to demo highlighting.
Just invoke ./release.sh and follow instructions.
If you want to test the release script without actually releasing anything, do:
./release.sh --dry
--help: Only print installing-into-$PATH help if we aren't already being
executed from inside of the $PATHgit add -p behavior.git show --stat properlydiff3 and highlight the resultgit.^diff, ^index, ^+++ and ^--- lines in bold white+ / - on added / removed linesgit show 28e074bd0fc246d1caa3738432806a94f6773185 with and without riff.ax->bx\nc properlycore.pager in git help config.git diff | riff and get reasonable output.git show 2ac5b06: Should highlight all of both some and
one or.$PAGER to riff--help--version--versionInspired by part of
git show 77c8f77 -- bin/riff is highlighted as an upside down L.ci.sh's existencecross which
uses Docker for cross compiling)release.sh's existencerelease.sh FIXMEsci.sh, add a test case verifying that our exception handler prints
backtraces in release builds (should fail when stripping the release binary)ci.sh, add a test case verifying that our exception handler prints line
numbers for the riff frames in the backtraces, in release builds. This
should fail when stripping the release binary.diff and
highlight the result.riff -b path1 path2 to diff files ignoring whitespacegit show 5e0a1b2b13528f40299e78e3bfa590d9f96637af and scroll to the end.
How should we visualize the reformatting of the No-newline-at-eof code?git show 0f5dd84 and think about how to visualize one line
changing to itself with a comma at the end plus a bunch of entirely
new lines. Think of a constant array getting one or more extra
members.git show -b 77c8f77 and think about what rule we should use to
highlight the leading spaces of the + refined and + page lines
at the end of the file.git show 57f27da and think about what rule we should use to get
the REVERSE vs reversed() lines highlighted.git conflict
resolution diff. File format is described at
http://git-scm.com/docs/git-diff#_combined_diff_format.