Terminal GuideTerminal Guide
lazygit icon

lazygit

Git Tools
macOSLinuxWindows
Go

Simple terminal UI for git commands.

Official Website

Features

Interactive StagingCommit ManagementMerge/RebaseCustom Commands

Installation

Homebrew
brew install lazygit
Pacman (Arch)
pacman -S lazygit
Chocolatey
choco install lazygit

Why use lazygit?

lazygit is a TUI (Terminal User Interface) tool that allows intuitive Git operations on the terminal. You can perform advanced Git operations with just keyboard commands, without needing to memorize complex Git commands.

Intuitive UI

View status, staging, commit history, and branches on one screen. Understand state visually.

Interactive Rebase

Reorder commits, squash, and fixup with drag-and-drop-like operations.

Branch Management

Create, switch, merge, and rebase branches with a single key. Even complex operations are simple.

Conflict Resolution

Visually review merge conflicts and choose which changes to apply.

Interface

┌─ Status ────────────────┬─ Staged Changes ─────────────────┐
│ On branch: main
│ Your branch is up to date
│ Unstaged changes (2)
│ M src/main.rs
│ M README.md
│ Staged (1)
│ A src/utils.rs
├─ Commits ────────────────┴──────────────────────────────────┤
│ * abc1234 feat: add user authentication (2 hours ago)
│ * def5678 fix: resolve login bug (1 day ago)
│ * ghi9012 docs: update README (2 days ago)
├─ Branches ───────────────────────────────────────────────────┤
│ * main
│ feature/new-ui
│ fix/bug-123
└──────────────────────────────────────────────────────────────┘

lazygit screen layout: Status, staging, commit history, and branches can be viewed at a glance.

Installation

Installation
# macOS (Homebrew)
brew install lazygit

# Ubuntu/Debian
sudo add-apt-repository ppa:lazygit-team/release
sudo apt-get update
sudo apt-get install lazygit

# Arch Linux
sudo pacman -S lazygit

# Install with Go
go install github.com/jesseduffield/lazygit@latest

# Conda
conda install -c conda-forge lazygit

Basic Usage

Startup

Basic Commands
# Run inside Git repository
lazygit

# Launch at specific path
lazygit -p /path/to/repo

# Specify config file location
lazygit --use-config-file="~/.config/lazygit/config.yml"

Key Bindings

KeyActionDescription
SpaceStagingStage/unstage file
cCommitEnter commit message and commit
pPushPush to remote
PPullPull from remote
nNew BranchCreate new branch
MMergeMerge selected branch
rRebaseRebase onto selected branch
sSquashSquash commit
eEditEdit commit message
dDeleteDelete commit/branch
?HelpShow key binding list
qQuitExit lazygit

Main Features

Staging Operations

Staging is possible not just at the file level, but also at the line and hunk level.

Staging Operations
# File screen
Space    # Stage/unstage entire file
Enter    # Show file diff
Tab      # Toggle between staged/unstaged

# Diff display screen
Space    # Stage line/hunk
a        # Stage all changes
v        # Range selection mode

Commit Operations

Commit Operations
# Commit screen
c        # New commit
A        # Amend to previous commit
s        # Squash (combine with commit below)
f        # Fixup (squash without message)
r        # Reword commit message
d        # Delete commit (dangerous)
Ctrl+j   # Move commit down
Ctrl+k   # Move commit up

Branch Operations

Branch Operations
# Branch screen
n        # Create new branch
Space    # Checkout
M        # Merge into current branch
r        # Rebase onto selected branch
R        # Rename remote branch
d        # Delete branch
f        # Fetch
F        # Force fetch

Merge & Rebase

Merge & Rebase
# Interactive rebase
i        # Start interactive rebase
Ctrl+j/k # Change commit order
s        # Squash
f        # Fixup
d        # Drop (delete)
e        # Edit (edit commit)

# Conflict resolution
Enter    # Open conflict file
Space    # Select ours/theirs
b        # Accept both changes

Configuration & Customization

Configuration File

Customize settings in ~/.config/lazygit/config.yml.

config.yml
# ~/.config/lazygit/config.yml

gui:
  # Theme settings
  theme:
    activeBorderColor:
      - green
      - bold
    inactiveBorderColor:
      - white
    selectedLineBgColor:
      - blue
  # Enable mouse
  mouseEvents: true
  # Scroll height
  scrollHeight: 2

git:
  # Use --rebase for pull
  pull:
    mode: 'rebase'
  # Auto fetch
  autoFetch: true
  autoFetchInterval: 120

# Customize key bindings
keybinding:
  universal:
    quit: 'q'
    return: '<esc>'
    scrollUpMain: '<pgup>'
    scrollDownMain: '<pgdown>'

Custom Commands

Custom Commands
# Add custom command
customCommands:
  - key: 'C'
    context: 'files'
    command: 'git commit -m "{{.Form.Message}}"'
    description: 'Custom commit'
    prompts:
      - type: 'input'
        title: 'Commit message'
        key: 'Message'
        initialValue: ''

Tips & Tricks

  • *Press ? anytime to show help. You can see key bindings available in the current panel
  • *Press @ to show command log. You can see which Git commands have been executed
  • *Press + to start cherry-pick mode from the selected commit
  • *Press ctrl+o to open files in the default editor
  • *Press / to use filtering search. You can quickly find commits and branches
  • *When Git hooks (like pre-commit) fail, error messages are displayed making it easy to identify the cause
Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More