lazygit Cheatsheet
0.44Navigate git like a pro with lazygit keyboard shortcuts
Official docs →If you've ever found yourself typing git log --oneline --graph --decorate --all for the fifteenth time today, lazygit is about to become your new best friend. It's a terminal UI for git that turns the sprawling mess of git commands into a keyboard-driven interface where staging, committing, rebasing, and resolving conflicts all happen in a few keystrokes. Think of it as the middle ground between raw git CLI and a full-blown GUI — you get visual feedback without leaving the terminal.
The mental model is simple: lazygit is organized into panels (Status, Files, Branches, Commits, Stash), and you switch between them with number keys or Tab. Inside each panel, you navigate with j/k (or arrow keys if that's your thing), and press keys to perform actions on the selected item. Most actions are single keystrokes — no colons, no prefixes, no :wq-style commands. Context matters: pressing d in the Files panel discards changes, but in the Stash panel it drops a stash entry.
The best way to learn lazygit is to just open it in a repo and start pressing things. The ? key is your safety net — it shows you every available shortcut for the current panel. This cheatsheet covers the shortcuts you'll reach for daily and a few power-user moves that'll make you wonder how you ever lived without them. Everything here is based on default keybindings; if you've customized your config, your mileage may vary.
Tips
Press Enter on a file in the Files panel to drop into line-by-line staging mode. This is lazygit's killer feature — you can stage individual lines, not just whole hunks. Use v to toggle range select for staging multiple lines at once.
Undo almost anything with z. lazygit uses the reflog under the hood, so even dropped commits and bad rebases can be reversed. It's not infinite, but it covers the "oh no" moments.
You can define custom commands in ~/.config/lazygit/config.yml. For example, bind a key to git log --all --oneline --graph or a project-specific deploy script. Custom commands can prompt for input, confirm before running, and even show output in a panel.
Use the : key to run any arbitrary shell command without leaving lazygit. This is great for one-off operations like git bisect start or running your test suite against a specific commit.
When resolving merge conflicts, lazygit highlights conflicting sections and lets you pick the incoming or current change with a single keypress. Navigate conflicts with [ and ], then pick a side with Space. Way less error-prone than editing conflict markers by hand.
You can bulk-select files for staging by pressing v to enter range select mode in the Files panel. Move with j/k to extend the selection, then press Space to stage everything at once.
If you work with multiple repos, press Ctrl+r to open a recent repositories picker. lazygit remembers where you've been, so switching context is instant.