Git Delta with Magit

I rarely use any of the diff utilities these days and when I do it’s mostly Ediff to resolve merge conflicts. That probably means I’m working too hard but I’ve always been that way: I just never think of using diff unless I’m really in trouble.

Most other folks are more reasonable and use some sort of diff regularly. A common use case is checking the differences between two versions of a file stored in a Git repository. Magit, of course, has that built in—several options, in fact—but Kaushal Modi really likes the syntax highlighted diff he gets with the command line tool delta.

Of course, Modi wants to stay in Emacs and use Magit. Fortunately, Dan Davison, the author of delta has a package, magit-delta, that allows it to work with Magit. Installation is pretty easy. Just install delta from your favorite package manager (it’s called git-delta in most package managers) and then install magit-delta by adding it to your init.el.

There is, apparently, an issue with displaying line numbers with git-delta (an issue has been raised) but it’s easy to work around that. Take a look at Modi’s post to see screen shots of both the normal delta and the magit-delta output. If you like what you see, just install delta and magit-delta and give them a try. It’s easy to turn it off if you decide you don’t like it.

UPDATE [2022-07-10 Sun 13:09]: Added link to Modi’s post.

This entry was posted in General and tagged . Bookmark the permalink.