A terminal git workflow with lazygit and delta

Install lazygit and delta, set delta as git's pager, render lazygit diffs with it, and stage hunks, commit and rebase from the keyboard.

how-to7 steps

Updated

in short

Set delta as git's pager in ~/.gitconfig, add it as a diff renderer in lazygit's config.yml, then do daily work in lazygit: Space to stage, Enter to stage single hunks, c to commit and the Commits panel to squash, reword and reorder.

delta reformats git's diff output with syntax highlighting, word-level changes and line numbers. lazygit is a terminal UI for git that shows files, branches and commits in panels and runs git commands behind single keys.

The two connect cleanly: delta handles git diff, git log -p and git add -p on the command line, and lazygit pipes its own diff view through delta. This guide sets up both, then covers the keys for staging, committing and rebasing.

Tools used

Before you start

  • git installed; git 2.35 or newer for the zdiff3 conflict style below
  • A package manager such as Homebrew, pacman, dnf, winget or Scoop
  • A terminal with 256-color or true-color support for delta's syntax themes

Steps

  1. Step 1: Install lazygit and delta

    delta's package is usually called git-delta, but the command it installs is delta. On Debian 12 and Ubuntu 25.04 or older, apt has no lazygit package; download the release tarball from the lazygit GitHub releases page instead, and use the .deb from delta's releases page.

    sh
    # macOS or Linux with Homebrew
    brew install lazygit git-delta
    
    # Arch Linux
    sudo pacman -S lazygit git-delta
    sh
    # Windows
    winget install -e --id=JesseDuffield.lazygit
    winget install dandavison.delta
    sh
    lazygit --version
    delta --version
  2. Step 2: Make delta git's pager

    These settings come from delta's README. core.pager sends git diff, git show and git log -p through delta. interactive.diffFilter colors the hunks in git add -p. navigate lets you jump between files with n and N. Set delta.light true instead of dark on a light terminal theme, or leave both out to let delta detect it.

    sh
    git config --global core.pager delta
    git config --global interactive.diffFilter 'delta --color-only'
    git config --global delta.navigate true
    git config --global delta.dark true
    git config --global merge.conflictStyle zdiff3
    gitconfig
    # Resulting ~/.gitconfig
    [core]
        pager = delta
    
    [interactive]
        diffFilter = delta --color-only
    
    [delta]
        navigate = true
        dark = true
    
    [merge]
        conflictStyle = zdiff3
  3. Step 3: Check delta on the command line

    Run a diff in any repository with uncommitted changes. You should see file headers in boxes and highlighted code. For a two-column view, add side-by-side = true under [delta], or try it once with --side-by-side.

    sh
    git diff
    sh
    git diff | delta --side-by-side
  4. Step 4: Render lazygit's diffs with delta

    lazygit shows diffs in its own main panel, so it needs to be told about delta separately. Find the config directory with lazygit --print-config-dir and edit config.yml there; on Linux that is ~/.config/lazygit/config.yml. You can also press e in the Status panel to open it.

    Keep --paging=never as in lazygit's docs, so delta prints the diff instead of starting its own pager; lazygit handles scrolling. Use --light instead of --dark on a light theme. delta's navigate option does not work inside lazygit.

    lazygit 0.64 and newer use diffRenderers. Versions 0.56 to 0.63 use pagers with a pager: key, and older releases use paging:. Newer releases migrate the old keys automatically.

    sh
    lazygit --print-config-dir
    yaml
    # config.yml, lazygit 0.64+
    git:
      diffRenderers:
        - command: delta --dark --paging=never
    yaml
    # config.yml, lazygit 0.56 to 0.63
    git:
      pagers:
        - pager: delta --dark --paging=never
    yaml
    # config.yml, lazygit 0.55 and older
    git:
      paging:
        colorArg: always
        pager: delta --dark --paging=never
  5. Step 5: Stage files and single hunks

    Run lazygit inside a repository. The number keys 1 to 5 jump to the Status, Files, Branches, Commits and Stash panels.

    In the Files panel, Space stages or unstages the selected file and a stages everything. Press Enter on a file to open the staging view. There, Space stages the selected hunk, a switches between selecting whole hunks and single lines, v starts a range selection, and Tab switches between the unstaged and staged sides. Esc goes back to the file list.

    sh
    cd ~/code/my-repo
    lazygit
  6. Step 6: Commit, amend and push

    With changes staged, press c in the Files panel, type the summary and press Enter. C opens your git editor instead. A amends the last commit with what is staged. P pushes the current branch and p pulls; if there is no upstream yet, lazygit asks for one.

  7. Step 7: Rebase from the Commits panel

    Press 4 for the Commits panel. On any commit, r rewords the message, s squashes it into the commit below, f does a fixup (squash and drop the message), d drops it, and Ctrl-j or Ctrl-k moves it down or up. lazygit runs the interactive rebase for you.

    To change the contents of an older commit, select it and press e; lazygit stops the rebase there. Make your changes, stage them, press A in the Files panel to amend that commit, then press m and choose continue. The same m menu aborts or skips. To rebase your branch onto another, select the target in the Branches panel and press r.

    If a step goes wrong, z undoes the last git action using the reflog and Z redoes it. Undo covers commits and branches, not uncommitted working-tree changes.

Troubleshooting

  • delta: command not found after installing git-delta: the binary is delta. Check that your package manager's bin directory is on PATH.
  • lazygit diffs are still plain: the config key does not match your version. Check lazygit --version and use diffRenderers, pagers or paging as shown in step 4.
  • Diff panel looks wrong after adding delta: check the command includes --paging=never, and remove any --navigate or side-by-side flags to rule them out.
  • Colors look wrong on a light theme: replace --dark with --light in lazygit and set delta.light true in ~/.gitconfig.
  • git add -p shows raw escape codes: interactive.diffFilter must be delta --color-only, not plain delta.
  • zdiff3 is rejected: your git is older than 2.35. Use merge.conflictStyle diff3 instead.

Tips

  • Press ? in any lazygit panel to list the keys available there.
  • You can list several entries under diffRenderers and cycle through them with |, for example delta with and without --side-by-side.
  • { and } shrink or grow the diff context in lazygit.

Also worth a look

  • gituiAnother keyboard-driven git TUI with staging and commit panels.
  • tigText-mode git browser focused on reading history and blame.
  • difftasticStructural diff tool; lazygit runs it as an `extDiff` renderer.

FAQ

Does lazygit use delta automatically if git's core.pager is set?
Not by default. lazygit renders its own diff panel and only pipes it through a renderer listed in its config.yml, so add delta there as well as in ~/.gitconfig.
Why does n/N navigation not work inside lazygit?
delta's navigate option relies on its own pager, which lazygit replaces. Use lazygit's scrolling keys, or run git diff outside lazygit to use n and N.
Can I undo a squash or drop in lazygit?
Yes. Press z right after the action; lazygit reads the reflog to restore the previous commit state. It does not restore uncommitted file changes.

related