delta
View side-by-side diffs with syntax highlighting
TLDR
Compare files or directories
Compare files or directories, showing the line numbers
Compare files or directories, showing the differences side by side
Compare files or directories, ignoring any Git configuration settings
Compare, rendering commit hashes, file names, and line numbers as hyperlinks, according to the hyperlink spec for terminal emulators
Display the current settings
Display supported languages and associated file extensions
SYNOPSIS
delta [OPTIONS] [FILE]
command | delta [OPTIONS]
PARAMETERS
--side-by-side
Displays diffs with old and new code side-by-side, improving readability for wider terminals.
--line-numbers
Shows line numbers on both sides of the diff, aiding in code context and referencing.
--syntax-theme
Specifies the syntax highlighting theme to be used for code within the diff. Many popular themes are supported.
--theme
Specifies the general color theme for delta's non-syntax-highlighted output elements like headers and line numbers.
--features
Enables a comma-separated list of named features defined in the configuration, e.g., line-numbers, side-by-side.
--hunk-header-style
Sets the styling for diff hunk headers (e.g., omit-git-diff-header, box, line).
--minus-style
Sets the styling for removed lines (e.g., red bold, syntax).
--plus-style
Sets the styling for added lines (e.g., green bold, syntax).
--file-style
Sets the styling for file headers (e.g., blue bold, italic).
--paging
Controls when delta should paginate output. Modes include always, never, or auto (default).
--width
Sets the screen width for side-by-side view. Relevant when --side-by-side is enabled.
--tabs
Sets the tab stop width, controlling how tab characters are rendered.
--navigate
Enables keyboard navigation between hunks using 'n' for next and 'p' for previous.
DESCRIPTION
delta is a command-line utility that acts as a powerful pager for git diff, diff, and grep output. Its primary function is to make code changes significantly more readable and visually appealing by adding syntax highlighting for code, line numbering, and the option for a side-by-side view (split diff). It intelligently handles whitespace, moved lines, and provides a clear distinction between added, removed, and unchanged lines.
Developed in Rust, delta is known for its speed, rich feature set, and extensive configurability. Users can customize colors, themes, line wrapping, and various display options to match their preferences. It integrates seamlessly with git by setting it as the pager.diff or pager.log configuration, transforming raw diff output into a highly organized and visually distinct representation of code changes, thereby improving the developer's experience when reviewing modifications.
CAVEATS
Using delta effectively with git requires proper configuration of git's pager settings.
While generally very fast, extremely large or complex diffs might still challenge performance.
The extensive customization options, though powerful, can sometimes be overwhelming for new users.
CONFIGURATION
delta is most commonly configured via the ~/.gitconfig file under a [delta] section. This allows users to set default options for its behavior when integrated with git, avoiding the need to pass numerous command-line flags every time.
INTEGRATION WITH GIT
To use delta as the default pager for git diff output, users typically run: git config --global core.pager "delta".
For interactive patches, git config --global interactive.diffFilter "delta --color-only" can be used.
HISTORY
git-delta was created by Dan Davison and first publicly released in 2019. It emerged as a modern alternative to existing diff highlighting tools, aiming to provide a faster, more configurable, and feature-rich experience for reviewing code changes. Written in Rust, it quickly gained traction in the git community due to its superior rendering capabilities, robust side-by-side view, and advanced syntax highlighting, features often less developed in prior solutions. Its active development continues to introduce improvements in performance, new features, and broader configuration options, solidifying its position as a preferred git pager for a growing number of developers.