Until recently I was using the diff-highlight script that comes with a git installation, but it stopped working and instead of investigating why, I started looking for more modern alternatives. One of the projects I kept seeing was Delta so I gave it a quick go and it was a great replacement with nice additional features.

It is nice and fast (written in Rust of course) and renders nice diffs when I am using git diff or git add -p (where -p is short for --patch) to add files to commits.

As an aside, if you’re not already using git add -p to stage your commits then you’re missing out. It allows you to interactively stage a file or just part of it (git refers to these parts as hunks). I have previously written about this in Staging patches with git add.

Getting setup is pretty easy by installing the git-delta package from your systems package manager - I am using Nix with home-manager that has a delta configuration built-in, but it could be Homebrew or even Chocolately.

Now you just need configure git to use it as the pager and for interactive diffs (git add -p for example). In ~/.gitconfig you can add something like the following to get started and as a good base to customise further too. The configuration options are in the delta documentation.

  pager = delta

  diffFilter = delta --color-only

  navigate = true    # use n and N to move between diff sections

  conflictstyle = diff3

  colorMoved = default

As I am using home-manager my configuration looks more like this Nix configuration, which automatically handles setting delta as the pager and interactive diff tool.

  programs.git = {
    enable = true;
    delta = {
      enable = true;
      options = {
        hyperlinks = true; # makes file paths clickable in the terminal
        hyperlinks-file-link-format = "vscode://file/{path}:{line}"; # opens links in vscode

        features = "decorations interactive";

        interactive = {
          keep-plus-minus-markers = false;

        decorations = {
          commit-decoration-style = "bold yellow box ul";
          file-style = "bold yellow ul";
          file-decoration-style = "none";

Now if you run git add -p you’ll get nicely highlighted diffs for each hunk that you’re staging for commit. Delta makes it easier to read the diffs and therefore, hopefully, spot mistakes quicker.