★ git delta
• 268 words • 2 min • updated
I’ve been using the venerable
diff-highlight
script to power various git diff operations in the terminal. It is a decent
improvement on top of stock git diff, but it’s somewhat of an
annoying
maintenance burden to manage it across various environments, as it’s installed
in different ways on various systems:
#!/bin/sh
if hash git >/dev/null 2>&1; then
# git-diff-highlight: alpine:/usr/bin/, arch, debian
path_munge "/usr/share/git/diff-highlight" "/usr/share/doc/git/contrib/diff-highlight"
# brew
if hash brew >/dev/null 2>&1; then
path_munge "$(brew --prefix)"/share/git-core/contrib/diff-highlight
fi
fiThus I decided to migrate to git-delta,
which is:
- quite popular
- written in Rust™1
- available in all package managers I’m interested in – hence it’s one install command away from my system, no need for extra configs <== And this is the main reason I wanted to migrate to it.
On macOS, the package is called git-delta whereas the binary is called
delta:
% brew install git-delta
% brew ls git-delta | grep bin/
/opt/homebrew/Cellar/git-delta/0.18.2_3/bin/deltaThe integration with git is as follows:
% grep -E '\[core\]|pager =|delta' ~/.gitconfig
[core]
# delta > diff-highlight > plain cat
pager = "delta --diff-highlight 2>/dev/null || ((diff-highlight 2>/dev/null || cat) | ${PAGER:-less})"It falls back to diff-highlight when delta is not available.
delta is quite
configurable:
% grep -EA3 '\[delta\]' ~/.gitconfig
[delta]
navigate = true
side-by-side = false
line-numbers = trueOne caveat of using delta: the git diff output is not suitable for sharing,
as it does not contain diff markers, relying on colors instead.
See this post for a workaround.
Update(2025-09-07): I’ve been finding delta quite pleasant to use.
-
Always an (over)hyped reason to migrate, but, oh well… ↩︎