Delta: A new git diff tool to rock your productivity

Axel Navarro - Jul 16 '20 - - Dev Community

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


Enter fullscreen mode Exit fullscreen mode

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


Enter fullscreen mode Exit fullscreen mode

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"


Enter fullscreen mode Exit fullscreen mode

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


Enter fullscreen mode Exit fullscreen mode

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


Enter fullscreen mode Exit fullscreen mode

delta 2 files

Comparing two folders

We can compare 2 folders to see the diffences:



delta dir1 dir2


Enter fullscreen mode Exit fullscreen mode

Delta directory example

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.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player