DEV Community

loading...
Cover image for Delta: A new git diff tool to rock your productivity
Cloud(x);

Delta: A new git diff tool to rock your productivity

navarroaxel profile image Axel Navarro ・3 min read

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 yay -S git-delta-bin in Archlinux.

Or, find your destiny here: https://github.com/dandavison/delta#installation

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

Delta sections

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

delta in dark mode

Show line numbers!

Do you want to display line numbers? easy-peasy!

git config --global core.pager "delta --line-numbers --dark"

delta with line numbers

Delta vs GitHub

A simple comparison between the default format delta output and a GitHub diff view.

delta GitHub
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:

Delta with side by side view

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

delta 2 files

Comparing two folders

We can compare 2 folders to see the diffences:

delta dir1 dir2

Delta directory example

More delta

You have a lot of possible customization options you could investigate in the README 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.

Discussion (2)

pic
Editor guide
Collapse
terkwood profile image
Felix Terkhorn

I'm excited about this for two reasons:

  • I need a better dark mode solution for my reviews, like, yesterday... I know I can install some creepy browser extension and make Github dark, but I'm too paranoid to allow that! 👓
  • Love seeing CLI rust apps take over the world 🦀

Thanks for posting. This is now on my shortlist of stuff to try out.

Collapse
codigo47 profile image
codigo47

Amazing!, I use GitAhead, but this tool makes things easier and faster for quick diffs