In the last post I did in this little series of tooling improvements, the main draw of Bat was its syntax highlighting. This post is kind of that on steroids.

I came across Difftastic very recently and am already wowed by it.

Difftastic is a command-line diff tool for showing the difference between two files. We already have diff which shows you added, removed, or changed lines, but Difftastic operates on the structure of the parsed document, rather than just the raw lines.

A visual example is probably the best way to describe this. Here is what a traditional diff might look like:

A diff showing a change in the file "global.json" changing a JSON value from "8.0.100" to "9.0.100". The entire line is shown twice, first with the old value in red as a removal, then in green with the new value as an addition.
An example diff.

And here is what it looks like in Difftastic:

The same diff shown in Difftastic. Here it shows old and new versions side-by-side and highlights the changed JSON value only - red on the left and green on the right. The part of the version number that actually changed - the 8 to a 9 - is in bold and underlined on both sides.
The same diff in Difftastic.

It highlights not only the change in the line, but also the change in the JSON value.

I've seen stuff like this previously in graphical tools like Kaleidoscope (which I also adored until their recent change in pricing model):

The same diff shown in Kaleidoscope. Here the entire JSON value is highlighted, not only the changed version component.
The same diff in Kaleidoscope

However, having this in the Terminal is quite powerful, particularly for remote scenarios such as over SSH (or Mosh now, as per earlier in the series). Difftastic also goes one step further by underlining the segment of the value which changed (in the above screenshots, just the 8 to a 9).

I've only been using this for a short period so far, but it seems quite nice and useful and will probably find a way into my default toolbox.

Difftastic is available for most (if not all) desktop platforms.