delta — Git Diff Syntax Highlighter
Linux / Modern CLI Tools / delta.html
💬 "delta command"
delta (package name git-delta) is a tool that adds syntax highlighting to git diff and diff output. Instead of plain red and green text, it colors changes to match the code so you can read what changed much faster.
Written in Rust, once you set it as git's default pager, git diff, git show, and git log -p become readable automatically. It highlights line ranges and logical changes, not just single lines.
- Concept: A pager that applies syntax highlighting and a cleaner layout to git diff and similar output.
- Features: Syntax colors, line highlighting, file-move/copy detection, sidebar, and background diff.
- Strength: One config makes every git diff readable, speeding up review and rebase work.
- Use when: Reviewing code, rebasing, or resolving conflicts and you want changes to be obvious.
Basic Usage
delta is installed once as a git pager, then you keep using git as usual and it applies automatically.
1. Integrate with git (one-time)
Point git's default pager and interactive filter at delta.
git config --global core.pager delta
git config --global interactive.diffFilter "delta --color-only"
git config --global delta.navigate true
2. Use git as usual
Your normal git commands are now highlighted.
git diff
git show
git log -p --stat
git add -p # interactive add is highlighted too
3. Use outside git
Apply it to plain diff files too.
diff -u old.txt new.txt | delta
cat changes.diff | delta
Installation & Download
delta installs via cargo, a package manager, or a release binary.
| Environment | Command |
|---|---|
| cargo | cargo install git-delta |
| Ubuntu/Debian (if packaged) | sudo apt install git-delta |
| macOS (Homebrew) | brew install git-delta |
| Release binary | github.com/dandavison/delta/releases |
Verify with delta --version. Git integration is done with the three git config lines above. If less is very old, disable paging with git config --global pager.delta 'delta --paging=never'.
Common Options
| Command / Key | Description |
|---|---|
delta.navigate | Move between files with n/N inside a diff |
delta.side-by-side | Enable side-by-side layout |
delta.line-numbers | Show line numbers |
--features syntax-theme | Pick a syntax theme |
--paging=never | Output all at once without the pager |
3 Essential Command Combinations
git diff | delta— Highlight a diff for readinggit log -p | delta— Review commit changes with syntax colorsgit config --global core.pager delta— Apply delta to every git diff
💬 "Using delta on a real server"
A step-by-step look at inspecting changes during review and rebase.
Step 1 · Install delta
Install via cargo or a package manager.
cargo install git-delta || sudo apt install git-delta
Step 2 · Wire into git
Set it as the pager.
git config --global core.pager delta
Step 3 · Review changes
Diffs are now highlighted automatically.
git show HEAD
git diff --staged
How it is used in practice
1. Side-by-side review
Situation — Compare changes left and right in one view.
git diff --staged | delta --side-by-side
Result — Added and removed lines are visible at a glance.
Point — Quickly judge which lines changed during review.
2. Checking during rebase
Situation — Inspect a rebase conflict.
git rebase --continue # when a conflict appears
git diff | delta
Result — The conflict block is highlighted in syntax colors for faster diagnosis.
Point — Easier on the eyes on large diffs, reducing mistakes.
Caveats
- Very old
lessmay not render some colors; a recentlessis recommended. - If you use bat, run
bat cache --buildso syntax highlighting works well together. - If colors are too strong, switch themes with
--features ansi-darkand similar.