Git Tricks with Tri and Difft
26 March 2026
Updated: 26 March 2026
Assumed audience: Developers/technical people who use git and/or enjoy terminal UIs (TUIs)
So I finally got tri running super fast which I already talked about today and I came across something mildly annoying but not all bad so thought it would be nice to write down
I use difft for my git diffs. This works really nicely as it’s got some syntax awareness and integrates really well into other tools I use such as lazygit
Now, I’m a Unix Philosophy dude so I build my tools to do the same - so naturally I wanted to use difft with tri - so, here’s how to do that
The below examples are using Nushell so your shell’s exact syntax may vary but the idea is the same
1git diff HEAD --name-only | GIT_EXTERNAL_DIFF="difft --color=always --display=inline" tri --preview `git diff HEAD -- `Okay, braindump definitely. Realistically, since I want difft to always behave like this, It’s probably worth setting the environment variable elsewhere, but the steps are basically:
- Use the
GIT_EXTERNAL_DIFFenvironment variable to have thedifftcommand, this causes git to use the entire command and not just execute the binary provided as withdiff.external, so I can provide the flags to formatdifftas desired - Then just use
trias normal
Assuming you’ve set step 1. within your shell, the command is more simply:
1# step 1.2$env.GIT_EXTERNAL_DIFF = "difft --color=always --display=inline"3
4#step 2.5git diff HEAD --name-only | tri --preview `git diff HEAD -- `Which is just the normal way that tri works so yay
And that’s it okbye