Back to Resources Resource

lazygit - Visual Git in Your Terminal

A simple terminal UI for git commands. Stage, commit, rebase, and resolve conflicts without memorizing commands.

Git commands are powerful but hard to remember. Staging, rebasing, cherry-picking - you constantly look up syntax. lazygit changes that by giving you a visual interface right in your terminal. See branches, commits, and diffs side-by-side, and execute commands with single keystrokes.

🎮

Git Made Visual

See your entire repository state at a glance. Stage files with spacebar, commit with 'c', push with 'P'. No more memorizing git commands.

The 4-Panel Interface

lazygit shows you everything you need in one view - files, branches, commits, and diffs, all navigable with arrow keys:

lazygit 1 Files M src/App.tsx M src/hooks/useAuth.ts ? src/utils/helper.ts D old-config.json 2 Branches * feature/auth main develop 3 Commits abc123f Add login form def456a Setup auth hook 789bcd0 Initial commit 4 Diff: src/App.tsx @@ -15,6 +15,12 @@ import { useState } from 'react'; import { Router } from './router'; - import { oldAuth } from './auth'; + import { useAuth } from './hooks/useAuth'; + import { LoginForm } from './components'; function App() { + const { user, login } = useAuth(); + + if (!user) { + return <LoginForm onLogin={login} />; + } space stage c commit P push p pull ? help

lazygit's 4-panel layout: Files (top-left), Branches (mid-left), Commits (bottom-left), and Diff preview (right)

Key Features

📝

Visual Staging

Stage entire files or individual hunks with a single keystroke. See exactly what you're committing.

🌿

Branch Management

Create, switch, merge, and delete branches visually. See branch relationships at a glance.

🔄

Interactive Rebase

Squash, reorder, and edit commits without remembering rebase commands. Drag and drop commits.

📦

Stash Management

Create, view, apply, and drop stashes visually. Preview stash contents before applying.

Practical Examples

Here's how to accomplish common git workflows with lazygit:

Installation

# macOS
brew install lazygit

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

# Arch Linux
pacman -S lazygit

Launch lazygit

# Run in any git repository
lazygit

# Or create an alias in your .zshrc/.bashrc
alias lg="lazygit"

Common Workflow: Stage, Commit, Push

# In lazygit:
# 1. Navigate to file with arrow keys
# 2. Press 'space' to stage
# 3. Press 'c' to commit
# 4. Type message and press Enter
# 5. Press 'P' (shift+p) to push

Interactive Rebase Workflow

# In lazygit (Commits panel):
# 1. Navigate to the commit you want to rebase onto
# 2. Press 'e' to start interactive rebase
# 3. Use 's' to squash, 'r' to reword, 'd' to drop
# 4. Move commits with ctrl+j/k
# 5. Press 'm' to finish rebase

Resolve Merge Conflicts

# When conflicts occur:
# 1. Navigate to conflicted file
# 2. Press 'Enter' to view conflict
# 3. Press 'b' to choose base, 'o' for ours, 't' for theirs
# 4. Or press 'e' to edit in your editor
# 5. Press 'space' to stage resolved file

Why Developers Love It

  • No Command Memorization - Every action has a visible keybinding. Press '?' for full help.
  • See Everything at Once - Files, branches, commits, and diffs in one view.
  • Undo Mistakes Easily - Press 'z' to undo almost any action, including commits.
  • Fast Interactive Rebase - Squash and reorder commits without complex commands.
  • Works Over SSH - Full functionality on remote servers, no GUI needed.

Cheatsheet

Essential keyboard shortcuts for lazygit:

Shortcut Action Context
space Stage/Unstage Files panel
c Commit Any panel
P Push Any panel
p Pull Any panel
n New Branch Branches panel
M Merge into current Branches panel
r Rebase Branches panel
s Squash Commits panel (rebase mode)
z Undo Any panel
S Stash Files panel
1-5 Switch Panel Navigate between panels
? Help Show all keybindings

Pro Tips

Level up your lazygit workflow with these advanced techniques:

📋

Stage Individual Lines

Press Enter on a file to enter line-by-line staging mode. Use space to stage individual hunks or lines, perfect for splitting changes into logical commits.

🔍

Search Commits

Press '/' in the commits panel to search commit messages. Great for finding when a specific change was introduced.

🔗

Cherry-pick Commits

Press 'c' on a commit to copy it, switch to another branch, and press 'v' to paste (cherry-pick) it there.

🔧

Custom Commands

Configure custom commands in ~/.config/lazygit/config.yml. Bind frequently used git workflows to single keys.

🌐

Git Bisect

Press 'b' in the commits panel to start git bisect. Mark commits as good/bad visually to find the commit that introduced a bug.

🎨

Customize Colors

Edit your config to match your terminal theme. Many pre-made themes available at github.com/jesseduffield/lazygit/wiki/Custom-Themes.

Getting Started

  1. 1

    Install lazygit

    macOS: brew install lazygit | Ubuntu: sudo apt install lazygit

  2. 2

    Create an Alias

    Add alias lg="lazygit" to your shell config for quick access

  3. 3

    Learn the Basics

    Navigate with arrow keys, stage with space, commit with c, push with P, help with ?

  4. 4

    Use It Daily

    Replace your git commands with lazygit and never look back

Make Git Visual Today

Stop memorizing git commands. See your repository, stage changes, and manage branches with simple keystrokes.

View on GitHub

Explore More Resources