>_ josetilabs.com
← blog

02 Nov 2026 · ferramenta, git · 4 min

Read git diffs with delta

The standard git diff shows lines with + and - in plain text. Delta is a pager that reads that diff and returns the same content with syntax highlighting, line numbers and, if you want, two columns. It does not replace git: it is just the program git calls to show the diff. See also lazygit and bat for reading files.

Install

bash
# Debian/Ubuntu (community package may lag)
sudo apt install git-delta

# or direct binary
curl -LO https://github.com/dandavison/delta/releases/download/0.20.1/delta-0.20.1-x86_64-unknown-linux-musl.tar.gz
tar -xzf delta-0.20.1-x86_64-unknown-linux-musl.tar.gz
sudo install delta-0.20.1-x86_64-unknown-linux-musl/delta /usr/local/bin/delta
delta --version

The current version is 0.20.1 (published 2026-10-04). It is a single binary with no runtime. The project is open source under the MIT license and has more than 20 thousand stars on GitHub.

Terminal showing git config core.pager returning delta and delta --version returning 0.20.1
Delta installed and configured as git's pager.

The gitconfig

ini
[core]
    pager = delta

[interactive]
    diffFilter = delta --color-only

[delta]
    navigate = true
    side-by-side = true
    line-numbers = true
    syntax-theme = Monokai Extended

[merge]
    conflictstyle = diff3

pager = delta makes git call delta instead of less. diffFilter applies delta to git add -p as well. navigate = true lets you jump between files with n and N. side-by-side = true opens two columns. line-numbers shows the line number on both sides. conflictstyle = diff3 shows the common base in merge conflicts.

Three real uses

  1. git diff opens the formatted diff, with highlighting per language and line numbers.
  2. git log -p uses the same pager, so history becomes readable too.
  3. git diff -- file.py restricts to one file; navigate jumps between hunks.

Shortcuts inside delta

With navigate = true, use n for the next file and N for the previous one. Inside the diff, the arrows scroll line by line and space scrolls a page. q quits the pager. These shortcuts come from less, so anyone who already uses less learns nothing new.

When not to use delta

Delta is a pager, not a diff generator. If the output goes to a file or to another program, use git --no-pager diff or git diff > changes.patch. In CI scripts, prefer the plain diff, which is stable and does not depend on a terminal. Delta shines for quick reviews in the terminal; for automation it only gets in the way.

How to verify

bash
git config --get core.pager
delta --version
git diff | delta --no-gitconfig | head

The first line should print delta. The second, delta 0.20.1. The third shows the diff with formatting, without depending on the gitconfig.

If it goes wrong

Bar chart comparing 372 bytes of git diff with 1779 bytes of delta output
Delta's formatting costs bytes, but the diff stays the same.

Comparison

Tool Syntax highlighting Line numbers Side by side Install
git diff no no no already there
delta yes yes yes single binary
diff-so-fancy partial no no npm or Perl

FAQ

Does delta change the diff? No. It only presents the same diff with formatting. The content does not change.

Does it work with other version control systems? Yes. It reads unified diff from stdin, so any tool that produces that format works. That includes diffs generated by svn, mercurial or custom scripts.

Does the pager make the terminal slower? Barely. A 19-line diff (372 bytes) became 24 lines (1779 bytes) with delta’s formatting. The execution time difference was below what you can measure by hand.

Can I turn delta off for one command? Yes. Use git --no-pager diff or GIT_PAGER=cat git diff.

Can I use delta with merge conflicts? Yes. With conflictstyle = diff3, delta shows the common base and both sides of the conflict with highlighting.

Does delta work in a Windows terminal? Yes, through WSL or Git Bash. A native Windows binary is also available on the releases page.

Can I change the color theme? Yes. syntax-theme accepts bat theme names; run delta --list-syntax-themes to see the installed options.

Sources

bash
#!/usr/bin/env bash
# delta: demonstrates the gitconfig and checks the installation.
set -u

if ! command -v git >/dev/null 2>&1; then
    echo "git not found; install git to run this script"
    exit 0
fi

W=$(mktemp -d)
cd "$W"
git init -q -b main
git config user.email "[email protected]"
git config user.name "demo"

printf 'def soma(a, b):\n    return a + b\n' > calc.py
git add calc.py
git commit -q -m base

printf 'def soma(a, b):\n    """Soma dois inteiros."""\n    return a + b\n\ndef divide(a, b):\n    return a / b\n' > calc.py

echo "=== suggested gitconfig ==="
cat <<'EOF'
[core]
    pager = delta
[delta]
    navigate = true
    side-by-side = true
    line-numbers = true
EOF

echo "=== plain diff ==="
git --no-pager diff

if command -v delta >/dev/null 2>&1; then
    echo "=== with delta ==="
    git --no-pager diff | delta --no-gitconfig
    echo "delta installed: $(delta --version)"
else
    echo "delta not installed; follow the install section"
fi

rm -rf "$W"
echo "done"

Read next

// By e-mail

Posts published here also go out by e-mail. Delivery has not started yet: whoever leaves an address now joins the first batch.

I store only your e-mail, the date and the record of this consent. No cookies, no trackers, nothing shared with third parties. Details in the privacy policy.