delta
Syntax-highlighting pager for git diff output.
Official WebsiteFeatures
diffInstallation
brew install git-deltapacman -S git-deltacargo install git-deltaWhy Use delta?
delta is a pager that beautifully and readably displays Git diff output. Changes that were hard to see in traditional diff output become instantly clear with syntax highlighting and visual emphasis.
Syntax Highlighting
Auto-detects programming language and displays code colorfully. Changes are intuitive and easy to understand.
Side-by-Side Display
Display before and after side by side. Code reviews become significantly more efficient.
Line Numbers
Display line numbers before and after changes. Easier to write code review comments with specific line references.
Word-Level Diff
Highlight changes at word level, not just line level. No subtle changes are missed.
Basic Usage
Standalone Use
# Pipe diff output to delta
diff -u file1.txt file2.txt | delta
# Display git diff with delta (before git config)
git diff | delta
# Compare files
delta file1.txt file2.txtOutput Example
Line numbers are displayed on left and right, with changes highlighted at word level.
Git Integration Configuration
To maximize delta's potential, configure it as Git's pager. Once set, delta will be used for all Git commands like git diff, git log, and git show.
Basic Configuration
[core]
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true # Jump between changes with n/N
light = false # For dark theme
side-by-side = false
[merge]
conflictstyle = diff3
[diff]
colorMoved = defaultConfiguration via Command Line
# Set delta as pager
git config --global core.pager delta
# Use delta in interactive mode
git config --global interactive.diffFilter "delta --color-only"
# Set merge conflict style
git config --global merge.conflictstyle diff3Recommended Configuration (Full Features)
[core]
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true
line-numbers = true
side-by-side = true
syntax-theme = Dracula
[merge]
conflictstyle = diff3
[diff]
colorMoved = defaultCommon Options
| Option | Description | Example |
|---|---|---|
-s, --side-by-side | Side-by-side display | delta -s |
-n, --line-numbers | Display line numbers | delta -n |
--navigate | Jump between changes with n/N keys | delta --navigate |
--syntax-theme | Syntax highlighting theme | delta --syntax-theme=Dracula |
--diff-so-fancy | diff-so-fancy style display | delta --diff-so-fancy |
--light | For light background terminals | delta --light |
--word-diff-regex | Word boundary regex pattern | delta --word-diff-regex="\\w+" |
Display Styles
Side-by-Side Display
Display before and after changes side by side. Especially useful for code reviews.
# Enable from command line
git diff --side-by-side
# Or always enable in config file
# ~/.gitconfig
# [delta]
# side-by-side = trueLine Number Display
Display line numbers for both before and after.
# Display line numbers
git diff --line-numbers
# Hide line numbers (if displayed by default)
git diff --no-line-numbersPractical Usage Examples
Git diff
# Display changes in working directory
git diff
# Display staged changes
git diff --staged
# Diff for specific file
git diff src/main.rs
# Diff between specific commits
git diff HEAD~3..HEADGit log
# Display log with patches
git log -p
# Display last 3 commits with patches
git log -p -3
# Change history for specific file
git log -p -- src/main.rs
# Log with statistics (file change stats)
git log --statGit show
# Display latest commit contents
git show
# Display specific commit
git show abc1234
# Show specific file at specific commit
git show HEAD~2:src/main.rsGit blame
# Display last editor for each line (highlighted with delta)
git blame src/main.rs
# For specific line range only
git blame -L 10,20 src/main.rsConfiguration and Customization
Check Available Themes
# Display theme list
delta --list-syntax-themes
# Preview specific theme
delta --syntax-theme="Nord" < my-diff.patch
# Popular theme examples
# - Dracula
# - Nord
# - Monokai Extended
# - GitHub
# - OneHalfDark
# - gruvbox-darkCustom Color Configuration
[delta]
# Background color for added lines
plus-style = syntax "#1f3d1f"
plus-emph-style = syntax "#2a5d2a"
# Background color for deleted lines
minus-style = syntax "#3d1f1f"
minus-emph-style = syntax "#5d2a2a"
# File header style
file-style = bold yellow ul
file-decoration-style = yellow box
# Hunk header style
hunk-header-style = line-number syntax bold
hunk-header-decoration-style = blue boxFeatures (Presets)
delta has built-in features that allow you to apply settings in bundles.
[delta]
features = decorations
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
hunk-header-decoration-style = cyan box ul
[delta "line-numbers"]
line-numbers-left-style = cyan
line-numbers-right-style = cyan
line-numbers-minus-style = 124
line-numbers-plus-style = 28Integration with bat
delta uses bat's syntax highlighting engine. You can share bat's themes and syntax definitions.
[delta]
# Use the same theme as bat
syntax-theme = Dracula
# To use bat's custom theme
# Available after running bat cache --buildComparison with diff
| Feature | Standard diff/git diff | delta |
|---|---|---|
| Syntax Highlighting | - | 200+ languages |
| Side-by-Side Display | - | Supported |
| Line Numbers | - | Both before and after |
| Word-Level Diff | Possible with --word-diff | Highlighted by default |
| Change Navigation | - | Jump with n/N keys |
| Themes | None | Many themes |
| Git Integration | Native | Seamlessly integrated |
Tips
- •Use
nkey to jump to next change,Nkey for previous change (when--navigateis enabled) - •If terminal width is narrow, disable
--side-by-sidefor better readability - •For GitHub/GitLab-style display, use
--syntax-theme=GitHub - •Customize pager with
DELTA_PAGERenvironment variable (default: less) - •For merge conflicts, set
merge.conflictstyle = diff3to also display base version - •In CI/CD environments, use
--no-pageroption or disable via environment variable