Skip to main content

Getting Started with lazygit: Install, Basic Operations, and Recommended Config

Toolsbase Editorial Team
lazygitGitTerminalTUIDev Environment

lazygit is a Git client that runs in your terminal (a TUI). Written in Go, it lets you stage, commit, manage branches, and run interactive rebases entirely from the keyboard — no Git commands to type. It has earned more than 60,000 stars on GitHub.

This guide walks through lazygit in order: install → reading the screen → the daily workflow → practical patterns → recommended config. Every key and setting described here is based on the verified data behind our lazygit keybindings & commands reference (v0.63.x, 144 entries).

When you need detailed descriptions or config examples for individual keys, keep the reference open alongside this article. Everything here reflects lazygit v0.63.x (as of July 2026).

1. What Is lazygit — Why a Terminal Git UI

Picking lines with git add -p, opening an editor for git rebase -i, running git stash list to find the right number before git stash pop — operations that take several steps with raw Git commands collapse into one or two keystrokes in lazygit.

  • Staging is fast: select a file and press space. Line-level partial staging works from the keyboard too
  • Rewriting history stops being scary: squash, fixup, and reword are single keys, and z undoes your last Git operation if you slip
  • State is always visible: files, branches, commits, and stashes share one screen, with diffs rendered instantly in the main pane
  • It teaches you Git: the command log (@) shows the actual Git commands each action ran

If GUI clients feel heavy but raw commands feel tedious, lazygit sits exactly in between — you never leave the terminal.

2. Installation

Install commands for the major platforms:

# macOS / Linux (Homebrew)
brew install lazygit

# Windows (winget / Scoop)
winget install -e --id=JesseDuffield.lazygit
scoop bucket add extras && scoop install lazygit

# Arch Linux
sudo pacman -S lazygit

# Debian 13+ / Ubuntu 25.10+
sudo apt install lazygit

# With a Go toolchain
go install github.com/jesseduffield/lazygit@latest

Fedora users can install via COPR (dnf copr enable dejan/lazygit), and binary releases are available for other environments. Once installed, run lazygit inside any Git repository to start it.

Typing lazygit every time gets old, so most users set up an alias first:

echo "alias lg='lazygit'" >> ~/.zshrc && source ~/.zshrc

3. Reading the Screen — the Five-Panel Layout

On launch you get five panels on the left and a large main view (diffs and other detail) on the right.

Panel Role
Status Repository name, current branch, and overall state
Files Changed files in the working tree — where staging and committing start
Branches Local branches, remotes, and tags (switch with tabs)
Commits Commit history — where rebase and cherry-pick start
Stash Stash entries

Navigation takes just a handful of keys:

Key Action
h / l Move between panels (arrow keys also work)
j / k Move up/down within a list (arrow keys also work)
[ / ] Switch tabs within a panel
enter Drill into the selected item
esc Cancel and go back to the previous view or panel
0 Focus the main view (diff display)
? Show the keys available in the current panel

The single most important thing to understand about lazygit: the same key means different things depending on which panel has focus. For example, d shows discard options in the Files panel, drops a commit in the Commits panel, and deletes a stash entry in the Stash panel. Whenever you're unsure, press ? to list what's available right now.

4. The Daily Workflow — stage → commit → push in Three Keys

Everyday Git work runs on three keys in the Files panel:

  1. space — toggle staging for the selected file (use a to toggle all files at once)
  2. c — commit the staged changes; a commit message prompt opens
  3. P (Shift+p) — push the current branch to its upstream; you'll be prompted to set one if missing

Add these four and you've covered most day-to-day operations:

Key (Files panel) Action
p Pull changes from the remote
A Amend the last commit with the staged changes (git commit --amend)
d Show discard options for the selected file
z Undo the last Git operation (reflog-based; covers commit operations, not working-tree changes)

The z undo shines when you've dropped or squashed the wrong commit. If you undo too far, Z redoes.

5. Practical Patterns

Here's how the operations that feel like a chore with raw Git commands play out in lazygit.

5-1. Line-Level Staging (Partial Commits)

For the "I only want to commit these lines of this file" situation:

  1. Select the file in the Files panel and press enter — the line-staging view opens
  2. space — toggle staging for the selected line/hunk (a switches between line and hunk selection modes)
  3. v — range-select mode, to stage several lines at once
  4. tab — switch between the staged and unstaged views
  5. Press c to commit right there, or esc to return to the Files panel

The equivalent of git add -p's manual edit mode is E (edit the selected hunk in your external editor).

5-2. Interactive Rebase (squash / fixup / reword)

Move to the Commits panel and history editing becomes one key per action:

Key (Commits panel) Action
i Start an interactive rebase on the branch's commits
s Squash the selected commit into the one below (messages are combined)
f Fixup: merge the selected commit into the one below, discarding its message
r Reword the commit message
d Drop (delete) the selected commit
e Start an interactive rebase from the selected commit (marked for editing)
ctrl+j / ctrl+k Move the selected commit down / up

No editing pick/squash lines in an editor like git rebase -i — select a commit and press a key. To abort or continue a rebase in progress, use m.

If your review workflow stacks fix-up commits, press F to create a "fixup!" commit targeting the selected commit, then S later to apply them all at once (autosquash).

5-3. Stash

To shelve work in progress, press s in the Files panel (stash all changes). To stash only staged or only unstaged changes, press S and pick an option.

Restoring happens in the Stash panel:

Key (Stash panel) Action
space Apply the stash (the entry is kept)
g Pop: apply the stash and delete the entry
d Drop the stash entry
n Create a new branch from the stash
enter View the files contained in the stash

Instead of hunting for the right number with git stash list and typing git stash pop stash@{2}, you pick from a list and press one key.

5-4. Cherry-Pick

  1. In the Commits panel (or a branch's commit list opened with enter), press C on each commit you want to copy
  2. Check out the target branch with space in the Branches panel
  3. Back in the Commits panel, press V to paste (runs the cherry-pick)

Press ctrl+r to reset the copied-commit selection.

5-5. Resolving Merge Conflicts

When a merge or rebase hits conflicts, select the conflicted file in the Files panel and press enter to open the resolution view:

Key (resolution view) Action
space Pick the selected hunk (yours / theirs)
b Keep both sides' hunks
z Undo the previous conflict resolution

Press M for whole-conflict resolution options, and m to abort or continue the merge/rebase itself.

5-6. Branch Operations

Key (Branches panel) Action
space Check out the selected branch
n Create a new branch off the selected one
N Move unpushed commits to a new branch
- Switch back to the previously checked-out branch
M Merge the selected branch into the current one
r Rebase the checked-out branch onto the selected one
o Create a pull request for the selected branch

N is the rescue key for "I committed to main without branching first" — what takes a git branch + git reset --hard dance with raw commands is a single key here.

Find your config file with lazygit --print-config-dir (macOS: ~/Library/Application Support/lazygit/config.yml, Linux: ~/.config/lazygit/config.yml, Windows: %LOCALAPPDATA%\lazygit\config.yml). You can also open it directly from inside lazygit with alt+shift+c.

Three settings worth applying right after install:

Syntax-highlighted diffs with delta. Install delta, then point lazygit's pager at it:

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

External editor. Sets which editor the e key opens files in (if unset, lazygit guesses from git config core.editor and $EDITOR):

os:
  editPreset: 'vscode'

Nerd Fonts icons. If your terminal uses a Nerd Font, this shows file and branch icons (the quotes are required):

gui:
  nerdFontsVersion: "3"

Beyond these, config.yml also covers custom keybindings (keybinding), binding your own commands to keys (customCommands), UI language (gui.language), and more. Config examples live in the "Config & Customization" category of the reference.

FAQ

Do I need to be comfortable with Vim-style keys (h/j/k/l)?

No. Panel navigation (h / l) and list navigation (j / k) both work with arrow keys as well. Learn just space, c, and P to cover daily work, and look up the rest with ? as you go.

Can I undo a mistake?

Press z to undo your last Git operation. It's reflog-based and covers commit operations (working-tree changes are not included). If you undo too far, Z redoes.

Can I run raw Git commands from inside lazygit?

Yes — press : to type and run any shell command. Also, the command log (@) shows the actual Git commands each lazygit action executed, which makes it a surprisingly good way to learn Git itself.

Can I use it together with VS Code or another editor?

Press e in the Files panel to open the selected file in your external editor. Choose the editor via os.editPreset in config.yml (vscode / vim / nvim, and so on).

Which version does this article cover?

lazygit v0.63.x (as of July 2026). All keys and settings match the verified data behind the lazygit keybindings & commands reference, sourced from the official Keybindings_en.md, Config.md, and source code.

Summary

  • lazygit is a Git client that lives in your terminal. Start with the Files panel's three keys: space (stage) → c (commit) → P (push)
  • The core design idea: the same key changes meaning per panel. When in doubt, press ? for the current panel's key list
  • Interactive rebase, stash, cherry-pick, and conflict resolution all take far fewer steps than raw commands — and z undoes slips
  • Set up delta, your editor, and Nerd Fonts in config.yml and lazygit quickly becomes a daily driver

For the full keybinding list with detailed descriptions and config examples, see our maintained, data-verified references: