Skip to content

Instantly share code, notes, and snippets.

@simbo1905
Last active April 29, 2026 11:09
Show Gist options
  • Select an option

  • Save simbo1905/5f3a06daaf99cf17b9463b6579c45cf4 to your computer and use it in GitHub Desktop.

Select an option

Save simbo1905/5f3a06daaf99cf17b9463b6579c45cf4 to your computer and use it in GitHub Desktop.
Diff My Zebra — a delta + git config love letter

Diff My Zebra — a delta + git config love letter

You know that moment when you open a 500-line PR at 2am and it's just a wall of red and green? You can't tell if the code moved or if it actually changed. Yeah. We've all been there.

The Problem

  • Default git diff treats moved code as delete here, add there — 200 lines of churn for a simple refactor.
  • No line numbers, so when the test fails at runtime.py:223, you're counting hunks like a Victorian clerk.

The Solution: delta

Three lines in ~/.gitconfig give you side-by-side, syntax-highlighted diffs with moved-code detection.

[core]
    pager = delta
[delta]
    side-by-side = true
    line-numbers = true
    color-moved = zebra

That is the entire incantation. No plugin manager, no shell hooks. Pure git config.

Features That Actually Matter

Feature What it buys you
core.pager = delta Every diff command (diff, show, log -p, even blame) gets syntax highlighting automatically.
side-by-side = true Old left, new right. Your visual cortex does pattern-matching for free. Narrow terminal? Gracefully falls back to unified.
line-numbers = true Real file line numbers in the gutter. When the test fails at line 223, you scroll and 223 is right there.
color-moved = zebra Moved blocks get alternating pastel stripes 🦓 instead of red/green noise. A refactor diff separates "stuff that moved" (pastels) from "stuff that actually changed" (loud red/green).

The One Footgun

core.pager does not cover git add -p. If you want delta there too:

[interactive]
    diffFilter = delta --color-only

--color-only is mandatory — without it you break hunk selection.

Quick Reference

  • Force unified for one command: git -c delta.side-by-side=false diff
  • Disable pager for piping: git --no-pager diff
  • Inspect config: delta --show-config
  • List themes: delta --list-syntax-themes

One-Liner Install

git config --global core.pager delta
git config --global delta.side-by-side true
git config --global delta.line-numbers true
git config --global delta.color-moved zebra
# optional:
git config --global interactive.diffFilter "delta --color-only"
git config --global delta.syntax-theme "Monokai Extended"

Why the zebra metaphor actually fits

A regular diff has two stripes — red and green. Information density: two bits per line. Zebra has many alternating stripes — each pair of matched-move blocks gets its own pastel. Information density: one bit per line for "moved or not", plus one extra bit per matched pair for "which moved block this is". It is literally adding a dimension to the diff. The fact that the default name for it is "zebra" 🦓 is the most honest naming decision in modern dev tooling. They could have called it delta.move-tracking-pairs. They called it zebra. Bless them. 🙏💩🦄


Filed under: things that paid for themselves the first time you used them. 💸✨🦓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment