delta (Git)
Syntax-highlighting pager for git diff/log/show.
Official WebsiteFeatures
Installation
brew install git-deltapacman -S git-deltacargo install git-deltaWhy Use delta?
delta is a feature-rich diff viewer written in Rust. By setting it as Git pager, you can display git diff and git show output beautifully with syntax highlighting.
Syntax Highlighting
Uses the same syntax definitions as bat/Sublime Text. Beautiful highlighting with support for many languages.
Side-by-Side Display
Display before and after changes side by side. Makes large changes easier to compare and speeds up reviews.
Word-Level Diff
Highlight changes within lines. See exactly what changed at a glance.
Rich Customization
Fine-grained settings for themes, colors, display formats. Customize display to your preferences.
Output Example
delta output example: Syntax highlighting and changes within lines are highlighted.
Side-by-Side Display
Use the --side-by-side option for side-by-side display.
Installation
# macOS (Homebrew)
brew install git-delta
# Ubuntu/Debian
sudo apt install git-delta
# or
wget https://github.com/dandavison/delta/releases/download/0.16.5/git-delta_0.16.5_amd64.deb
sudo dpkg -i git-delta_0.16.5_amd64.deb
# Arch Linux
sudo pacman -S git-delta
# Fedora
sudo dnf install git-delta
# Cargo (Rust)
cargo install git-delta
# Windows (Chocolatey)
choco install delta
# Windows (Scoop)
scoop install deltaGit Integration Setup
By setting delta as Git pager, the output of git diff,git show, git log -p, etc. will automatically be displayed with delta.
# Add to ~/.gitconfig
[core]
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true # Move between files with n/N
light = false # Dark theme (true: light theme)
side-by-side = false
[merge]
conflictstyle = diff3
[diff]
colorMoved = defaultBasic Usage
Standalone Usage
# Display diff output with delta
diff -u file1.txt file2.txt | delta
# Pipe git diff output
git diff | delta
# Compare two files
delta file1.txt file2.txt
# Side-by-side display
delta --side-by-side file1.txt file2.txt
# Use specific theme
delta --syntax-theme="Dracula" file1.txt file2.txtWith Git Commands
# git diff (automatically uses delta)
git diff
git diff --staged
git diff HEAD~3
# git show
git show HEAD
git show abc1234
# git log with diff
git log -p
git log -p --follow -- path/to/file
# Display merge conflicts
git diff --mergeCommon Options
| Option | Description |
|---|---|
--side-by-side / -s | Side-by-side display |
--line-numbers / -n | Show line numbers |
--navigate | Enable navigation between files with n/N |
--syntax-theme | Specify syntax highlighting theme |
--light | Use light theme |
--dark | Use dark theme |
--diff-so-fancy | diff-so-fancy style display |
--show-themes | Show available themes list |
Configuration and Customization
Detailed Configuration Example
# ~/.gitconfig [delta] section
[delta]
# Basic settings
navigate = true
light = false
# Line numbers
line-numbers = true
line-numbers-minus-style = "#ff6b6b"
line-numbers-plus-style = "#6bcb77"
line-numbers-left-style = blue
line-numbers-right-style = blue
# Highlighting
syntax-theme = "Monokai Extended"
minus-style = syntax "#3a0f0f"
plus-style = syntax "#0f3a0f"
minus-emph-style = syntax "#800000"
plus-emph-style = syntax "#008000"
# File header
file-style = bold yellow ul
file-decoration-style = yellow box
hunk-header-style = file line-number syntax
hunk-header-decoration-style = blue box
# Blame
blame-palette = "#1e1e2e" "#2a2a40" "#3a3a50"
blame-format = "{author:<18} {commit:<8} {timestamp:<15}"
# Side-by-side settings
side-by-side = true
line-numbers-left-format = "{nm:>4} "
line-numbers-right-format = "{np:>4} "Using Preset Themes
# Check available themes
delta --show-themes
# Popular presets
[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
# Monokai-style theme
[delta]
syntax-theme = "Monokai Extended"
# GitHub-style theme
[delta]
syntax-theme = "GitHub"
# Dracula-style theme
[delta]
syntax-theme = "Dracula"Integration with Other Tools
lazygit Integration
# ~/.config/lazygit/config.yml
git:
paging:
colorArg: always
pager: delta --dark --paging=nevertig Integration
# ~/.tigrc
set diff-highlight = true
set pager = deltagit blame Integration
# Display git blame output with delta
[blame]
pager = delta
# Or use directly
git blame file.rs | deltaComparison with Similar Tools
| Feature | delta | diff-so-fancy | colordiff |
|---|---|---|---|
| Syntax highlighting | Yes (many languages) | No | No |
| Side-by-side | Yes | No | No |
| Word-level diff | Yes | Yes | No |
| Line numbers | Yes | No | No |
| Customization | High | Medium | Low |
Tips
- *Setting
navigate = trueallows jumping between files withn/Nkeys - *When terminal width is narrow, setting
side-by-side = falseimproves readability - *Use
delta --show-syntax-themesto preview themes - *In CI environments like GitHub Actions, set
--paging=never - *Setting
hyperlinks = truemakes file paths clickable links (requires compatible terminal) - *Uses the same syntax definitions as bat, allowing consistent display with bat