How to Install and Use lazygit in Linux for a Fast Terminal Git Interface

While the standard Git command-line interface provides unrivaled versatility, executing repetitive daily routines—such as staging specific hunks of code, crafting granular commit messages, checking branch diffs, and interactive rebasing—often requires typing lengthy commands or opening heavyweight graphical IDEs. For terminal-centric engineers who demand high speed without sacrificing visual clarity, lazygit offers the perfect terminal user interface (TUI).

Written in Go, lazygit provides an intuitive keyboard-driven multi-panel dashboard directly inside your terminal window. It displays staged files, branches, commits, and diffs simultaneously, enabling you to manage repositories in seconds. Here is a complete guide on how to install lazygit across Linux distributions and harness its core features.

Why Choose lazygit for Version Control?

lazygit bridges the gap between raw shell commands and bloated GUI clients through several key capabilities:

  • Instant Keyboard Staging: Stage entire files, individual hunks, or single lines with single-keystroke commands (space), eliminating manual git add -p prompts.
  • Interactive Git Rebase: Reorder commits, squash changes, edit historical commits, or drop commits using intuitive letter keys instead of modifying temporary Vim buffer files.
  • Visual Merge Conflict Resolution: Resolve branch merge conflicts directly within a split diff panel without leaving the terminal canvas.
  • Lightweight Resource Footprint: Runs instantly within any terminal emulator (Alacritty, Kitty, GNOME Terminal) with negligible memory overhead.

Installing lazygit on Linux Distributions

lazygit can be installed quickly across major Linux distributions using native package managers or pre-compiled binaries.

Method 1: Ubuntu and Debian (via GitHub Binary)

To acquire the latest upstream binary release on Ubuntu or Debian:

LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": *"v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar -xf lazygit.tar.gz lazygit
sudo install lazygit -D -t /usr/local/bin/
rm lazygit.tar.gz lazygit
lazygit --version

Method 2: Arch Linux and Manjaro

lazygit is available directly in the official Arch Linux repositories:

sudo pacman -S lazygit

Method 3: Fedora and CentOS

On Fedora, install via the official package repository or Copr:

sudo dnf copr enable atim/lazygit -y
sudo dnf install lazygit -y

Navigating the lazygit Interface

To start lazygit, navigate to any valid Git repository and run:

lazygit

The screen divides into five primary panels numbered 1 through 5, with the main content/diff preview occupying the right half:

Panel # / Key Panel Name Primary Functions
1 Status View repo status, remotes, and quick sync options
2 Files Stage, unstage, discard, and commit file changes
3 Branches Switch branches, create new branches, fast-forward, merge
4 Commits Inspect commit log, interactive rebase, cherry-pick, squash
5 Stash View, apply, pop, and drop saved stashes

Essential Daily Workflows in lazygit

Mastering these high-frequency keyboard shortcuts will accelerate your Git operations:

  • Staging Files: Switch to the Files panel (press 2), navigate with arrow keys, and press Space to stage or unstage a file.
  • Staging Individual Lines/Hunks: Press Enter on a file to enter hunk-staging mode. Navigate to specific lines, press Space to stage selected lines, and press Esc to return.
  • Committing Changes: Press c in the Files panel, type your commit summary, and press Enter. To amend the previous commit, press A.
  • Pushing and Pulling: Press P (Shift + p) to push committed changes to your remote origin. Press p (lowercase) to pull upstream changes.
  • Switching Branches: Press 3 to enter the Branches panel, highlight the desired branch, and press Space to checkout.
  • Interactive Rebasing: In the Commits panel (press 4), highlight an older commit and press e to edit, s to squash into the commit below, or d to drop the commit.

Configuring lazygit Preferences

Customise keyboard bindings, colour themes, and pager tools in ~/.config/lazygit/config.yml. For example, to integrate the delta syntax highlighter:

git:
  paging:
    colorArg: always
    pager: delta --dark --paging=never

To quit lazygit at any time, simply press q.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.