lazygit Cheatsheet

0.44

Navigate 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.

Navigation Basics
1-5
Jump to Status / Files / Branches / Commits / Stash panel
Tab
Cycle to next panel
Shift+Tab
Cycle to previous panel
jk
Move down / up in current list
Ctrl+d
Scroll down main view (half page)
Ctrl+u
Scroll up main view (half page)
?
Show keybindings for current panel
Esc
Cancel / go back / close popup
q
Quit lazygit
[]
Switch between side panel tabs (e.g. Local / Remote / Tags)
{}
Scroll diff view left / right
x
Open menu with all available actions
Staging
Space
Stage / unstage selected file
a
Stage or unstage all files
Enter
Open file to stage individual hunks / lines
Space
Stage / unstage selected hunk (in staging view)
a
Stage / unstage entire file (in staging view)
Tab
Switch between staged and unstaged changes (in staging view)
e
Open file in editor
d
Discard changes in selected file (careful!)
D
Open discard options menu (discard all, clean, etc.)
i
Add file to .gitignore
Commits
c
Commit staged changes (opens message input)
C
Commit with git editor (for multiline messages)
A
Amend last commit with staged changes
r
Reword selected commit message
s
Squash selected commit into the one above it
f
Fixup — squash commit into parent, discard its message
d
Drop (delete) selected commit
t
Tag selected commit
g
Reset to selected commit (opens soft/mixed/hard menu)
y
Copy commit SHA to clipboard
o
Open commit in browser
Enter
View commit files and diff
Branching
Space
Checkout selected branch
n
Create new branch from current HEAD
d
Delete selected branch
r
Rebase current branch onto selected branch
M
Merge selected branch into current branch
R
Rename selected branch
c
Checkout branch by name (search)
f
Force checkout selected branch
Enter
View branch commits
u
Set / unset upstream for selected branch
w
Open worktree options
Stash
s
Stash all changes (from Files panel)
S
Open stash options (staged only, keep index, etc.)
Space
Apply selected stash entry
g
Pop selected stash entry (apply + drop)
d
Drop selected stash entry
Enter
View stash entry contents
r
Rename stash entry
Remote Operations
f
Fetch all remotes
p
Pull from remote
P
Push to remote
shift+P
Open push options (force push, set upstream, etc.)
u
Set upstream branch
Interactive Rebase
e
Start interactive rebase from selected commit (edit mode)
Ctrl+j
Move selected commit down during rebase
Ctrl+k
Move selected commit up during rebase
s
Mark commit for squash
f
Mark commit for fixup
d
Mark commit for drop
e
Mark commit for edit (pause rebase here)
p
Mark commit for pick (keep as-is)
m
Continue rebase / move to next step
Esc
Abort interactive rebase
z
Undo last action (via reflog)
Custom Commands & Extras
:
Open custom command prompt (run any shell command)
+
Open recent repos list
@
Open command log panel
/
Filter / search in current panel
Ctrl+r
Switch to a recent repository
W
Open diff menu (compare branches/commits)
Ctrl+o
Copy file name / path to clipboard
.
Show/hide command log at the bottom

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.

Related Tools