Terminal GuideTerminal Guide
delta icon

delta

Modern CLI
macOSLinuxWindows
Rust

Syntax-highlighting pager for git diff output.

Official Website

Features

Syntax HighlightingSide-by-Side ViewLine NumbersGit Integration
Replaces
diff

Installation

Homebrew
brew install git-delta
Pacman (Arch)
pacman -S git-delta
Cargo (Rust)
cargo install git-delta

Why 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

Basic Commands
# 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.txt

Output Example

───────────────────────────────────────────────────────
modified: src/main.rs
───────────────────────────────────────────────────────
33fn main() {
4 println!("Hello");
4 println!("Hello, World!");
55}
───────────────────────────────────────────────────────

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

~/.gitconfig
[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 = default

Configuration via Command Line

Git Config Commands
# 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 diff3

Recommended Configuration (Full Features)

~/.gitconfig
[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 = default

Common Options

OptionDescriptionExample
-s, --side-by-sideSide-by-side displaydelta -s
-n, --line-numbersDisplay line numbersdelta -n
--navigateJump between changes with n/N keysdelta --navigate
--syntax-themeSyntax highlighting themedelta --syntax-theme=Dracula
--diff-so-fancydiff-so-fancy style displaydelta --diff-so-fancy
--lightFor light background terminalsdelta --light
--word-diff-regexWord boundary regex patterndelta --word-diff-regex="\\w+"

Display Styles

Side-by-Side Display

Display before and after changes side by side. Especially useful for code reviews.

Side-by-Side Display
# Enable from command line
git diff --side-by-side

# Or always enable in config file
# ~/.gitconfig
# [delta]
#     side-by-side = true
Before
3 fn main() {
4 println!("Hello");
5 }
After
3 fn main() {
4 println!("Hello, World!");
5 }

Line Number Display

Display line numbers for both before and after.

Line Number Display
# Display line numbers
git diff --line-numbers

# Hide line numbers (if displayed by default)
git diff --no-line-numbers

Practical Usage Examples

Git diff

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..HEAD

Git log

git 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 --stat

Git show

git 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.rs

Git blame

git 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.rs

Configuration and Customization

Check Available Themes

Theme List
# 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-dark

Custom Color Configuration

~/.gitconfig
[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 box

Features (Presets)

delta has built-in features that allow you to apply settings in bundles.

~/.gitconfig
[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 = 28

Integration with bat

delta uses bat's syntax highlighting engine. You can share bat's themes and syntax definitions.

~/.gitconfig
[delta]
    # Use the same theme as bat
    syntax-theme = Dracula

    # To use bat's custom theme
    # Available after running bat cache --build

Comparison with diff

FeatureStandard diff/git diffdelta
Syntax Highlighting-200+ languages
Side-by-Side Display-Supported
Line Numbers-Both before and after
Word-Level DiffPossible with --word-diffHighlighted by default
Change Navigation-Jump with n/N keys
ThemesNoneMany themes
Git IntegrationNativeSeamlessly integrated

Tips

  • Use n key to jump to next change, N key for previous change (when --navigate is enabled)
  • If terminal width is narrow, disable --side-by-side for better readability
  • For GitHub/GitLab-style display, use --syntax-theme=GitHub
  • Customize pager with DELTA_PAGER environment variable (default: less)
  • For merge conflicts, set merge.conflictstyle = diff3 to also display base version
  • In CI/CD environments, use --no-pager option or disable via environment variable
Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More