The delta tool (a.k.a. git-delta, a.k.a. delta-diff) is a diff viewer written in Rust πͺ. Initially made to have a better Developer Experience using the git diff
command, but has evolved enough transcending a simple diff for git.
Installation
In windows, you can just download the delta.exe program from the official repository, or use a tool like: choco install delta
or scoop install delta
.
In MacOS, you could use brew install git-delta
.
Linux has a lot of alternatives, download the Debian package from the releases page, or run dnf install git-delta
in Fedora, or pacman -S git-delta
in Archlinux.
Or, find your destiny here: https://dandavison.github.io/delta/installation.html.
The basics
The basic usage is set delta
as your pager (make sure delta
is in your PATH variable)
git config --global core.pager delta
git show 0ff1a88cc
You can use --light
or --dark
to adjust the delta colors in your terminal:
git config --global core.pager "delta --dark"
git diff -- ClientApp/src/hook/useBrowserHardwarePermissions.ts
Show line numbers!
Do you want to display line numbers? easy-peasy!
git config --global core.pager "delta --line-numbers --dark"
Delta vs GitHub
A simple comparison between the default format delta output and a GitHub diff view.
delta | GitHub |
Side by side π
You can view a side-by-side diff view with -s
or --side-by-side
to see your git diff
in a really new way:
This feature rocks! And you can enable this in git using:
git config --global delta.side-by-side true
Other usages
Comparing outside the land of git
delta
is not limited to git
. We can use delta
to show a diff of 2 files.
delta dnscrypt-proxy.toml.pacnew dnscrypt-proxy.toml
Comparing two folders
We can compare 2 folders to see the diffences:
delta dir1 dir2
More delta
You have a lot of possible customization options you could investigate in the user manual or set the colors of your choice in your .gitconfig file. And this is only the version 0.3.0 of this young app.
Thanks to Dan Davison for this awesome tool! and if you π it too, leave a β in https://github.com/dandavison/delta.
Top comments (6)
I'm excited about this for two reasons:
Thanks for posting. This is now on my shortlist of stuff to try out.
Hey Felix! You can turn on dark mode in Github today.
Yah, it's fantastic!
I love this tool!!
Q: I like to switch between side-by-side and normal view, is there an easy way to pass an argument to
git diff
iso changing the global setting? Thx!Good question! It's explained here: dandavison.github.io/delta/configu...
You can change delta options for an one-off Git command using:
git -c
The answer is:
Amazing!, I use GitAhead, but this tool makes things easier and faster for quick diffs