If you spend any time working with git, you know the pain:
You run git diff
and are greeted by a wall of monochrome text. It's hard to spot what's changed, and even harder to enjoy the process.
But what if your diffs could be beautiful, colorful, and easy to navigate?
Enter git-delta #
git-delta is a syntax-highlighting pager for git and diff output. It transforms your diffs from boring to brilliant, with features like:
- Side-by-side diffs
- Syntax highlighting for dozens of languages
- Line numbers
- Word-level diff highlighting
- File and hunk decorations
- Navigation with keyboard shortcuts
- Clickable links (in supported terminals)
See the Difference #
Standard git diff output (BORING):
Fancy git-delta diff (AWESOME):
How to Get This Fancy Diff #
1. Install git-delta #
On macOS:
1brew install git-delta
On Ubuntu/Debian:
1sudo apt install git-delta
Or download from the releases page.
2. Configure git to use delta #
Add the following to your ~/.gitconfig
(or use git config --global ...
):
1[core]
2 pager = delta
3
4[delta]
5 dark = true # Use dark theme (set to false for light backgrounds)
6 syntax-theme = Dracula # High-contrast syntax theme
7 true-color = always # 24-bit color
8 side-by-side = true # Side-by-side diffs
9 line-numbers = true # Show line numbers
10 navigate = true # n/N to jump between diff sections
11 file-style = bold yellow # File headers stand out
12 file-decoration-style = yellow ul
13 hunk-header-style = line-number syntax
14 hunk-header-decoration-style = blue box
15 commit-decoration-style = bold magenta ul
16 commit-style = bold magenta
17 minus-style = red normal
18 plus-style = green normal
19 zero-style = syntax normal
20 diff-stat-align-width = 60
21 tabs = 4
22 max-line-length = 200
23 wrap-max-lines = 3
24 diff-highlight = true
25 hyperlinks = true
26
27[diff]
28 algorithm = histogram
29
30[interactive]
31 diffFilter = delta --color-only
32
33[merge]
34 conflictstyle = zdiff3
35
36[alias]
37 d = diff
38 ds = diff --staged
39 dc = diff --cached
40 lg = log --graph --oneline --decorate --all
41 showd = show --ext-diff
42
43[pager]
44 log = delta
45 show = delta
46 blame = delta
Why use diff.algorithm = histogram
?
By default, git uses the myers
diff algorithm, which works well for many cases but can sometimes produce confusing or less intuitive diffs—especially when code blocks are moved or reordered.
The histogram
algorithm is smarter about detecting moved and changed blocks, resulting in diffs that are often easier to read and review. It's particularly effective for source code, where changes are rarely just simple line additions or deletions.
In short: histogram
helps your diffs make more sense, so you can focus on what really changed.
3. Try it out! #
Run git diff
and enjoy your new, beautiful diffs.
Use n
and N
to jump between changes, and explore the side-by-side view.
Tip: For a list of available syntax themes, run
delta --list-syntax-themes
. If you use a light terminal, setdark = false
and pick a light theme.
Conclusion #
Upgrading your git diff output is one of the easiest ways to boost your productivity and make code review a pleasure. With git-delta, your diffs become clear, colorful, and even fun to read.
Give it a try, and never go back to boring diffs again!