lazygit guide: install, staging lines, interactive rebase and reviewing AI changes
lazygit started in 2018 as Jesse Duffield's answer to how tedious some git tasks are on the command line. It grew into one of the most widely used git interfaces of any kind. Today Stefan Haller leads most of the development, with releases every few weeks. Version 0.66.0 shipped on October 5, 2026, and patch releases 0.66.1 and 0.66.2 followed within two weeks.
lazygit does not replace git. It runs git commands for you and shows the results, and you can drop to the command line at any time. Its value is in making advanced operations, such as partial staging and interactive rebase, quick enough that you use them more often.
Installing lazygit
| System | Command |
|---|---|
| macOS | brew install lazygit |
| Windows | scoop install lazygit or winget install lazygit |
| Arch | sudo pacman -S lazygit |
| Other Linux | Distribution package, or a release binary from GitHub |
| Any platform with Go | go install github.com/jesseduffield/lazygit@latest |
Run lazygit in a repository. Many people add a short alias, such as alias lg=lazygit.
The layout
The screen has panels on the left and a main view on the right:
| Panel | Shows |
|---|---|
| Status | Repository, current branch, ahead and behind counts |
| Files | Changed files, staged and unstaged |
| Branches | Local branches, remotes, tags |
| Commits | History of the current branch, with a graph |
| Stash | Stashed changes |
Move between panels with the number keys 1 to 5 or Tab, and move within a panel with arrow keys or j and k. Press ? in any panel to see every key that works there. / filters the current list.
Everyday keys
| Key | Action |
|---|---|
| space | Stage or unstage the selected file, hunk or line |
| a | Stage all files |
| c | Commit staged changes |
| A | Amend the last commit, or amend a selected older commit with staged changes |
| P | Push |
| p | Pull |
| n (branches panel) | New branch |
| space (branches panel) | Check out the selected branch |
| Ctrl-Z / Ctrl-Y | Undo / redo the last action |
| e | Open the selected file in your editor |
Staging lines and hunks
Partial staging is one of lazygit's best features. Since version 0.66, you stage directly in the main view:
- Select a file and focus the diff.
- Move to a hunk and press space to stage it, or press v and select lines, then space.
- Jump between hunks with the hunk keys and between files with n and N.
- Press d to discard a hunk, or e to edit the file at that line.
This makes it easy to split a messy working tree into several clean commits.
Interactive rebase without the todo file
In the commits panel:
| Key | Action |
|---|---|
| s | Squash into the commit below |
| f | Fixup, squash and drop the message |
| d | Drop the commit |
| e | Stop at the commit to edit it |
| r | Reword the message |
| Ctrl-K / Ctrl-J | Move the commit up or down |
| A | Amend the selected commit with what is staged |
lazygit runs git rebase with the right todo list behind the scenes. If a rebase hits a conflict, the files panel shows the conflicted files, and since version 0.65 lazygit selects the conflicted commit and keeps resolved files visible so you can see your progress.
Cherry-pick, bisect and worktrees
Cherry-pick. In the commits panel, press Shift-C on one or more commits to copy them, switch branches, and press Shift-V to paste.
Bisect. Press b on a commit to start git bisect, then mark commits good or bad from the menu until lazygit finds the one that introduced a bug.
Worktrees. lazygit lists worktrees and lets you create and switch between them. Since 0.65, you can filter worktrees by branch name. Worktrees are useful when you run several AI agents in parallel, each in its own worktree.
Custom commands
lazygit's config file, opened with a global key added in 0.63 or at ~/.config/lazygit/config.yml, can bind keys to shell commands:
customCommands:
- key: "O"
context: "localBranches"
command: "gh pr create --head {{.SelectedLocalBranch.Name}} --web"
description: "Open a pull request for this branch"
- key: "T"
context: "commits"
command: "git stash && git checkout {{.SelectedLocalCommit.Hash}} && npm test; git checkout - && git stash pop"
description: "Run tests on the selected commit"
output: terminal
Template variables give you the selected file, branch, commit or remote. You can add prompts that ask for input or show a menu before the command runs.
Recent changes
- 0.63 (July 2026): direnv support, background polling to notice changes made outside lazygit, configurable side panels and a key for editing the config.
- 0.64 (August 2026): spinners for more long-running operations and auto-scroll when dragging to select a range.
- 0.65 (September 2026): a dimmed look when the window loses focus, better conflict handling during rebases and worktree filtering.
- 0.66 (October 2026): staging directly from the main view. Patch releases 0.66.1 and 0.66.2 added horizontal scrolling of diffs when line wrapping is off and better handling of deleted submodules and worktrees.
Reviewing AI agent changes with lazygit
AI coding agents tend to change many files at once. lazygit makes that easier to review:
- Open the files panel after an agent run and step through each diff.
- Stage the parts you accept and discard the rest hunk by hunk.
- Split one large agent change into several focused commits with line staging.
- If the agent committed for you, as Aider does by default, use the commits panel to reword, squash or drop its commits before pushing.
- Ctrl-Z undoes a lazygit action if you discard the wrong hunk.
Background polling, added in 0.63, means lazygit updates as the agent writes files, so you can keep it open in a tmux pane next to the agent.
Limits
It is still git. lazygit makes operations easier, not safer than git itself. Force pushes and discarded changes behave as they would on the command line, though undo covers many actions.
Keys take time to learn. Use ? often in the first week.
Large repositories. Very large repositories can be slower to refresh. Settings let you reduce how often lazygit polls.
lazygit compared with other git tools
| Tool | Type | Best for |
|---|---|---|
| lazygit | Terminal UI | Fast staging, rebasing and review from the terminal |
| tig | Terminal UI | Browsing history and blame |
| gitui | Terminal UI in Rust | A lazygit-like tool with a smaller feature set |
| GitHub Desktop, Fork, GitKraken | Desktop apps | Mouse-driven git with visual history |
Choose lazygit if you live in the terminal and want git's advanced features without memorizing their flags. For more terminal tools, see the terminal tools guide.
Frequently asked questions
What is lazygit used for?
lazygit makes git operations faster and more visible from the terminal. Instead of typing commands and reading text output, you see your changes, branches and history in panels and act on them with keys. It is most useful for tasks that are slow on the command line: staging part of a file, editing old commits through an interactive rebase, cherry-picking between branches, resolving merge conflicts and reviewing large diffs.
How do I install lazygit?
On macOS, run brew install lazygit. On Windows, use scoop install lazygit or winget. On Linux, most distributions package it, for example sudo pacman -S lazygit on Arch, and there are release binaries on GitHub. With Go installed, go install github.com/jesseduffield/lazygit@latest works on any platform. Run lazygit inside a git repository to start.
How do I stage only some lines of a file?
Select the file and press Enter to open its diff. Since version 0.66 you can stage directly from the main view: move to a hunk and press space to stage it, or press v to start selecting a range of lines and space to stage them. Use the hunk navigation keys to jump between hunks and n and N to jump between files. Press d to discard a hunk and e to open your editor on the selected line.
How do I squash or reorder commits?
Go to the commits panel. Select a commit and press s to squash it into the one below, f to fix it up and discard its message, d to drop it, e to stop and edit it, or Ctrl-K and Ctrl-J to move it up or down. lazygit runs the interactive rebase for you, so you never edit a rebase todo file by hand. If something goes wrong, Ctrl-Z undoes the last action.
Can lazygit run my own commands?
Yes. Custom commands in lazygit's config.yml bind a key to any shell command, with access to context such as the selected file, branch or commit through template variables. You can add prompts and menus for input. Teams use this for commands such as opening a pull request for the current branch, running tests on a commit or pushing to a specific remote.