Riff, the Refining Diff

Riff is a wrapper around diff that highlights which parts of lines have changed.

Screenshot of riff in action

Much like git, Riff sends its output to a pager, trying these in order:

  1. Whatever is specified in the $PAGER environment variable
  2. moar because it is nice
  3. less because it is ubiquitous

Usage

git 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

... 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

Installation

With Homebrew

brew install riff

From the Rust Crate

cargo install riffdiff

Manual Install

  1. Go here and download the correct binary for your platform

  2. chmod a+x riff-*

  3. mv riff-* /usr/local/bin/riff
  4. 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

See Also

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.

Development

If you put example input and output in the testdata directory, then cargo test will verify that they match.

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.

Making a new release

Just invoke ./release.sh and follow instructions.

If you want to test the release script without actually releasing anything, do:

./release.sh --dry

TODO

Misc

TODO future

DONE