How to Install and Use Delta in Linux for Syntax-Highlighted Git Diffs

Reviewing code changes via standard Git commands (such as git diff, git show, and git log -p) in the Linux terminal outputs raw terminal text where entire added or deleted lines are painted in flat red or green. Discerning precise character-level modifications, word changes within long lines, or nested syntax across large files requires significant mental effort. delta (often referred to as git-delta) is a modern, Rust-powered syntax-highlighting pager that transforms terminal diffs into beautiful, side-by-side or inline code views with true syntax highlighting.

Key Features of Delta

Developed specifically to improve command-line code review, delta introduces rich visual enhancements:

  • Language-Specific Syntax Highlighting: Uses Bat’s parsing engine to highlight code syntax according to file language (Python, Rust, C++, Go, HTML, JavaScript) within both added and removed blocks.
  • Within-Line Word Diffs: Emphasises exact edited words, variables, or punctuation changes with distinctive contrast shading rather than highlighting entire lines uniformly.
  • Side-by-Side Diff Layout: Renders two-column split diff views directly inside your terminal window, mimicking web pull request interfaces.
  • Git Blame and Grep Formatting: Enhances git blame with human-readable relative timestamps and cleans up git grep with colour-coded file separators.
  • Custom Themes: Includes dozens of popular colour themes out of the box (including Dracula, Solarized, Nord, Monokai, and GitHub).

Installing Delta Across Popular Linux Distributions

The delta binary is available across primary distribution repositories:

  • Ubuntu, Debian, and Linux Mint (via GitHub Release):
    # Download latest Debian package
    curl -LO https://github.com/dandavison/delta/releases/latest/download/git-delta_0.18.2_amd64.deb
    sudo dpkg -i git-delta_0.18.2_amd64.deb
  • Fedora and Red Hat Enterprise Linux:
    sudo dnf install git-delta
  • Arch Linux and Manjaro:
    sudo pacman -S git-delta
  • Cargo (Universal Rust Installation):
    cargo install git-delta

Configuring Git to Use Delta as the Default Pager

To integrate delta seamlessly with all your daily Git operations, update your global Git configuration (~/.gitconfig):

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
git config --global merge.conflictstyle "zdiff3"

Enabling Side-by-Side Diffs and Advanced Customisation

Open your ~/.gitconfig file in any text editor to fine-tune visual preferences:

[delta]
    navigate = true    # Use 'n' and 'N' to jump between diff sections
    line-numbers = true
    side-by-side = true
    syntax-theme = Dracula
    features = decorations

[delta "decorations"]
    commit-decoration-style = bold yellow box ul
    file-style = bold yellow ul
    file-decoration-style = none
    hunk-header-decoration-style = blue box

With side-by-side = true enabled, running git diff in any widescreen terminal displays clean two-column comparison viewports with synchronized scrolling and line numbers.

Using Delta Outside Git (Diffing Arbitrary Files)

You can also use delta to compare two arbitrary files or directories directly on your Linux filesystem:

delta old_config.yaml new_config.yaml

Or pipe traditional diff output directly into delta:

diff -u original.txt modified.txt | delta

This allows system administrators to review systemd unit changes or Apache configurations with rich syntax highlighting before restarting production daemons.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.