LazyGit: A Complete Guide to the Terminal UI That Makes Git Operations Fast
LazyGit is a terminal UI that makes staging individual lines, interactive rebase, and stash management fast and visual. Here's how to use it effectively.
LazyGit is a terminal-based git UI that makes complex git operations fast without requiring you to memorize obscure flag combinations. For developers who find the git command line powerful but verbose, and who find GUI git clients too slow or mouse-dependent, LazyGit sits in the exact right position: keyboard-driven, visual, and fast. It pairs particularly well with AI coding tools that make many changes across many files.
Why LazyGit Exists
The git command line is powerful but has a significant friction surface. To stage individual lines (not whole files), you run git add -p and navigate an awkward interactive prompt. To do an interactive rebase, you type git rebase -i HEAD~5 and then edit a text file. To view your stash history, it's git stash list followed by git stash show -p stash@{2}.
None of these are difficult once you know them. But they're all multi-step, require remembering syntax, and produce output that's hard to scan quickly. LazyGit replaces all of them with a single terminal UI where you navigate with arrow keys and trigger operations with single-character keybindings.
Status/Files - your working tree and staged changes
Branches - all local branches
Commits - commit history
Stash - stash entries
Files (detail pane) - the diff for whatever is selected
Navigate between panels with [ and ]. Move within a panel with j/k (Vim-style) or arrow keys.
Key Operations
Staging individual lines (not whole files). This is the operation that draws most developers to LazyGit. In the Files panel, select a file and press Enter to open its diff. Navigate to individual lines or hunks with arrow keys, and press Space to stage just that section. This lets you create clean, focused commits even when your working tree has unrelated changes mixed together.
Interactive rebase for commit cleanup. In the Commits panel, press e on any commit to start an interactive rebase from there. LazyGit shows you the rebase actions visually (pick, squash, fixup, drop, reword) and you apply them with single keystrokes. Squashing five "WIP" commits from an AI coding session into one clean commit takes about 20 seconds.
Viewing branch history visually. The Branches panel shows all branches with their last commit. Select a branch and the Commits panel updates to show that branch's history. You can navigate back and forth between branches and see what's on each without typing any commands.
Cherry-picking commits. Navigate to a commit in a different branch, press c to mark it for cherry-pick, then switch to your target branch and press v to apply it. Multi-commit cherry-pick works the same way - mark multiple commits with c, then apply them all.
Stash management. Create a stash with s from the Files panel. View all stashes in the Stash panel. Apply, drop, or pop stashes with single keystrokes. This is dramatically faster than the git stash command line.
Viewing and searching commit history. In the Commits panel, press / to search commits by message. Press Enter on any commit to see its full diff. Press y to copy the commit hash.
Why It Pairs Well with AI Coding Tools
When Claude Code, Cursor, or Aider make changes across 10 files in a session, the resulting git state can be messy. There may be unrelated changes in the working tree, you might want to split the AI's work into multiple commits, or you might want to squash its many incremental commits before pushing to a PR.
LazyGit makes all of this fast. Stage exactly the lines that belong in commit 1, commit, then stage the rest for commit 2. Or squash all the AI's commits into a single clean commit with a meaningful message. The combination of AI-generated code and LazyGit for git hygiene produces a clean, reviewable commit history even when the AI wrote most of the code.
Essential Keybindings
Inside LazyGit, press ? to see all keybindings. The most important ones:
gui:
showFileTree: true
nerdFontsVersion: "3" # If you use Nerd Fonts in your terminal
git:
paging:
colorArg: always
pager: delta # Use delta for better diff output
Pairing LazyGit with delta (a better diff viewer) gives you syntax-highlighted, readable diffs directly in LazyGit's diff pane.
Integration with Your Editor
LazyGit can open files in your editor directly. Press e on a file in the Files panel to open it. Configure your editor in config.yml:
os:
editCommand: "cursor" # or "code", "vim", "nvim"
This means you can spot an issue in a diff, press e, fix it in Cursor, save, and return to LazyGit to stage and commit - all without leaving the keyboard.
Pristren builds AI-powered software for teams. Zlyqor is our all-in-one workspace - chat, projects, time tracking, AI meeting summaries, and invoicing - in one tool. Try it free.
Practical deep-dives on LLMs, developer tools, and AI engineering. No filler. Unsubscribe any time.
// written byFIG. AUTH-01
530
Mahmudul Haque Qudrati
CEO & ML Engineer
CEO and ML Engineer at Pristren. Builds AI-powered software for teams and writes about machine learning, LLMs, developer tools, and practical AI applications.
Open Code Review – An AI-powered code review CLI tool: A Practical Overview
Open Code Review is an open-source CLI tool from Alibaba that uses AI to review code changes. It runs locally, supports multiple LLMs, and costs about $0.01 per review. Here's a practical breakdown.