Arch Linux AUR
(build from source) |
yay -S git-delta
or
git clone https://aur.archlinux.org/git-delta.git
cd git-delta
makepkg -csri |
Arch Linux AUR
(binary, no compilation required) |
yay -S git-delta-bin
or
git clone https://aur.archlinux.org/git-delta-bin.git
cd git-delta-bin
makepkg -si |
Cargo |
cargo install git-delta |
Debian / Ubuntu |
.deb files are on the releases page and at barnumbirr/delta-debian
dpkg -i file.deb . **IMPORTANT** If you are using Ubuntu <= 19.10 or are mixing apt sources, read https://github.com/dandavison/delta/issues/504, be extremely cautious, and try the versions linked against musl. |
Fedora |
dnf install git-delta |
FreeBSD |
pkg install git-delta |
Gentoo |
emerge dev-util/git-delta |
Homebrew |
brew install git-delta |
MacPorts |
port install git-delta |
Nix |
nix-env -iA nixpkgs.gitAndTools.delta
|
openSUSE Tumbleweed |
zypper install git-delta
|
Void Linux |
xbps-install -S delta
|
Windows (Chocolatey) |
choco install delta |
Windows (Scoop) |
scoop install delta |
Users of older MacOS versions (e.g. 10.11 El Capitan) should install using Homebrew, Cargo, or MacPorts: the binaries on the release page will not work.
See [repology.org/git-delta](https://repology.org/project/git-delta/versions) for the current version in each package repository.
Behind the scenes, delta uses `less` for paging. The version of `less` that comes with your operating system may be too old (currently, less v551 is a good choice). On MacOS, install `less` from Homebrew. For Windows, see [Using Delta on Windows](#using-delta-on-windows).
## Configuration
#### Git config file
Set delta to be the pager for git commands in your `.gitconfig`. Delta has many options to alter colors and other details of the output; `delta --help` shows them all. An example is
```gitconfig
[pager]
diff = delta
log = delta
reflog = delta
show = delta
[delta]
plus-style = "syntax #012800"
minus-style = "syntax #340001"
syntax-theme = Monokai Extended
navigate = true
[interactive]
diffFilter = delta --color-only
```
Note that delta style argument values in ~/.gitconfig should be in double quotes, like `--minus-style="syntax #340001"`. For theme names and other values, do not use quotes as they will be passed on to delta, like `theme = Monokai Extended`.
All git commands that display diff output should now display syntax-highlighted output. For example:
- `git diff`
- `git show`
- `git log -p`
- `git stash show -p`
- `git reflog -p`
- `git add -p`
Delta can also be used as a shorthand for diffing two files: the following two commands do the same thing:
```
delta a.txt b.txt
git diff a.txt b.txt
```
Delta also handles unified diff format, e.g. `diff -u a.txt b.txt | delta`.
For Mercurial, you can add delta, with its command line options, to the `[pager]` section of `.hgrc`.
#### Environment
Delta acts as a pager for git's output, and delta in turn passes its own output on to a "real" pager.
The pager that delta uses is determined by consulting the following environment variables (in this order):
- `DELTA_PAGER`
- `PAGER`
If neither is set, delta's fallback is `less -R`.
The behavior of delta's default pager, `less`, can be controlled using the `LESS` environment variable.
It may contain any of the `less` command line options and/or interactive less-commands (prefixed by a leading `+` sign; these are executed every time right after less is launched).
For full documentation of `less` configuration options, please see the `less(1)` [manual](https://jlk.fjfi.cvut.cz/arch/manpages/man/core/less/less.1.en).
In addition to `DELTA_PAGER`, and `PAGER`, delta currently also consults `$BAT_PAGER` (with priority between the two).
However, this is deprecated: please use `DELTA_PAGER` instead.
No other [`bat`](https://github.com/sharkdp/bat) environment variables are used by delta.
## Usage
### Choosing colors (styles)
All options that have a name like `--*-style` work in the same way. It is very similar to how
colors/styles are specified in a gitconfig file:
https://git-scm.com/docs/git-config#Documentation/git-config.txt-color
Here's an example:
```gitconfig
[delta]
minus-style = red bold ul "#ffeeee"
```
That means: For removed lines, set the foreground (text) color to 'red', make it bold and underlined, and set the background color to `#ffeeee`.
For full details, see the `STYLES` section in [`delta --help`](#full---help-output).
### Line numbers
```gitconfig
[delta]
line-numbers = true
```