Default Git diff output in terminal environments can be difficult to parse during complex code reviews. Standard coloured diffs simply paint added lines in plain green and deleted lines in plain red, stripping away syntax highlighting and offering no visual cue for small word-level edits within long lines. delta (also known as git-delta), developed in Rust, transforms your terminal diff experience by introducing full programming language syntax highlighting, side-by-side comparison panes, and granular within-line change tracking.
Why Upgrade Your Git Pager to delta?
Delta functions as a drop-in replacement pager for standard Git utilities like diff, show, log -p, and blame. Incorporating delta provides immediate visual improvements:
- Full Syntax Highlighting: Preserves code keywords, strings, types, and comments using themes from
bat. - Word-Level Diffing: Highlights the exact characters or words modified inside an edited line rather than just highlighting the entire row.
- Side-by-Side Comparison: Renders two-column split diffs directly within your terminal window.
- Merge Conflict Visualisation: Renders clear 3-way merge conflict blocks that make conflict resolution intuitive.
- Clean Line Numbers: Prints distinct, aligned line numbers for both the original and modified code streams.
Installing delta Across Linux Distributions
Delta is available in package managers across major Linux distributions or as a standalone binary.
Installing on Ubuntu and Debian
On modern Debian-based systems, install the official package or grab the latest .deb from GitHub:
# Download latest deb package
wget https://github.com/dandavison/delta/releases/latest/download/git-delta_0.18.2_amd64.deb
# Install via dpkg
sudo dpkg -i git-delta_0.18.2_amd64.deb
Installing on Arch Linux and Manjaro
Arch Linux maintains git-delta in the official repositories:
sudo pacman -S git-delta
Installing via Cargo (Rust)
If you have Cargo installed on your system:
cargo install git-delta
Configuring Git to Use delta by Default
To instruct Git to route all diffs and log outputs through delta, configure your global Git settings using the command line:
git config --global core.pager "delta"
git config --global interactive.diffFilter "delta --color-only"
git config --global delta.navigate true
git config --global delta.light false
git config --global delta.line-numbers true
Recommended Configuration in .gitconfig
For optimal usability and aesthetics, add a dedicated [delta] configuration block directly to your ~/.gitconfig file:
[core]
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true # use n and N to move between diff sections
light = false # set to true if using a light terminal theme
line-numbers = true
side-by-side = true # enable modern two-column diff layout
syntax-theme = Dracula
[merge]
conflictstyle = diff3
[diff]
colorMoved = default
Comparing Unified vs Side-by-Side Views
| Mode | Configuration | Best Suited For |
|---|---|---|
| Unified (Single Column) | side-by-side = false |
Narrow terminal splits or laptops with limited horizontal display width. |
| Side-by-Side (Split) | side-by-side = true |
Widescreen desktop monitors; clearly separates previous and current code states. |
| Inline Navigation | navigate = true |
Allows pressing n and N to jump forward and backward between modified files. |
Using delta with Other CLI Tools
You can also pipe standard Unix diff commands or GitHub CLI output directly into delta for immediate syntax highlighting:
# Compare two arbitrary files outside Git
diff -u old_script.py new_script.py | delta
# Review GitHub pull request diffs with gh
gh pr diff 42 | delta
Replacing Git’s basic pager with delta drastically improves code review velocity, reduces comprehension fatigue, and helps catch subtle bugs before committing.