Lazygit keyboard shortcuts

Lazygit's default keys from the keybindings file generated for release v0.66.0, grouped by the panel that has focus, with the navigation and text-input defaults from the config reference and the command-line flags added. One keymap serves Linux, macOS and Windows; only a few text-input defaults differ on macOS. Letters are case-sensitive: c commits and C commits with the git editor. The same letter does different jobs in different panels, so read the section of the panel you are in.

218 shortcuts in 16 sections. Checked row by row against Lazygit keybindings (docs/keybindings/Keybindings_en.md, release v0.66.0) on . Edited by Jay.

Global 30

ActionShortcut
Switch to recent repoOpens the list of recently opened repositories; inside the Commits panel the key clears the cherry-pick selection instead.Ctrl+R
Scroll main window upWorks while a side panel has focus, so a long diff can be read from the list.Page UporKorCtrl+U
Scroll main window downPage DownorJorCtrl+D
View command log optionsOffers showing or hiding the command log and moving focus to it.@
PushThe branch you are on goes to its upstream; with none configured, lazygit asks for one.P
PullUpdates the current branch from its remote; inside the Commits panel the key marks a commit as picked during a rebase.p
Increase rename similarity thresholdA deleted and an added file must be more alike to count as a rename; git.renameSimilarityThreshold holds the default.)
Decrease rename similarity thresholdLooser matching: less similar pairs of deleted and added files are shown as renames.(
Increase diff context sizeShows more unchanged lines around each change; git.diffContextSize holds the default.}
Decrease diff context sizeShows fewer unchanged lines around each change.{
Execute shell commandOpens a prompt; the command you type runs without leaving lazygit.:
View merge and rebase optionsAbort, continue or skip the merge or rebase that is in progress.m
RefreshReloads status and branches in the background; nothing is fetched from the remote.R
Next screen modeCycles the focused panel through normal, half and fullscreen sizes.+
Previous screen modeSteps back through the same three sizes._
Cycle diff renderersSwitches to the following entry among the diff renderers set up in your config.|
Cycle diff renderers in reverseGoes to the previous entry of that list instead.\
Jump to file within diffLists the files of the diff being shown and scrolls to the chosen one; focus does not move.Ctrl+G
Open external diff toolRuns git difftool on the selection inside the file, branch, commit and tag panels.Ctrl+T
CancelAlso closes menus, prompts and confirmation panels.Esc
Open keybindings menu?
View filter optionsLimits the commit log to matching commits, for example those touching one file path.Ctrl+S
View diffing optionsDiff against the selected ref, type a ref to compare with, or reverse the direction.WorCtrl+E
QuitqorCtrl+C
Quit without changing directorySkips the directory switch performed by the lg shell function described in the README.Q
Suspend lazygitCtrl+Z
Toggle whitespaceHides or shows whitespace-only changes in diffs; git.ignoreWhitespaceInDiffView holds the default.Ctrl+W
Edit config fileOpens lazygit's config file with the external editor; the Status panel offers it on e.Alt+Shift+C
UndoReverses the last git command by way of the reflog; working-tree changes are not restored.z
RedoReapplies the command that was just undone, again via the reflog.Z

Status panel 5

ActionShortcut
Edit config filee
Check for updateu
Switch to recent repoEnter
Show all branch logsRepeated presses cycle through the all-branches log views.a
Show all branch logs in reverseCycles through those log views in the opposite order.A

Files 25

ActionShortcut
Stage or unstage fileWith a diff focused, the key instead stages only the selected hunk or lines.Space
Stage allSwitches every file of the working tree between staged and unstaged at once.a
Focus file diff or collapse directoryOn a file, moves into its diff to work on single hunks or lines; a directory folds or unfolds.Enter
Discard changesOpens the choices for throwing away changes to the selected file.d
Reset working treeOpens reset choices for the whole working tree, up to nuking every change.D
CommitOpens the commit message panel for whatever is staged.c
Commit without pre-commit hookw
Commit using git editorHands the message over to the editor git is configured with.C
Amend last commitA
Find fixup base commitLocates the commit your current changes build on, sparing a manual scan of the branch.Ctrl+F
Edit fileUses the external editor; the diff and merge-conflict views have this key too.e
Open fileUses the default application, like a double-click in the file manager.o
Ignore or exclude filei
Refresh filesr
StashStashes all changes; the stash options key covers the other variants.s
View stash optionsChoose between stashing everything, only staged or only unstaged changes.S
View upstream reset optionsg
Toggle file tree viewSwitches between one flat list of paths and a tree grouped by directory; gui.showFileTree holds the default.`
Collapse all filesFolds every directory of the file tree; the Commit files panel has it too.-
Expand all filesUnfolds every directory of the file tree.=
View merge conflict optionsOpens the choices for resolving conflicted files.M
Fetchf
Filter files by statusNarrows the list to staged or to unstaged files.Ctrl+B
Copy path to clipboardCopies the path of the selected file; the Commit files panel has this key too.Ctrl+O
Copy file info to clipboardy

Staging and diff view 14

The staged pane below (Secondary) has the same keys, and from either pane c, w, C and Ctrl + F commit exactly as they do in the Files panel.

ActionShortcut
Switch diff paneMoves between the unstaged pane and the staged pane shown below it.Tab
Toggle hunk selectionSwitches between selecting whole hunks and selecting line by line.a
Stage or unstage selectionApplies to the selected hunk, line or range only.Space
Discard or unstage selectionAn unstaged change is thrown away with git reset; a staged one merely goes back to unstaged.d
Edit hunkOpens only the selected hunk with the external editor.E
Copy selected diff linesCtrl+O
Go to previous hunkLeftorh
Go to next hunkRightorl
Go to previous fileN
Go to next filen
Open pull request at lineOpens the branch's GitHub pull request at the selected line, ready for a comment.G
Exit to side panelEsc
Scroll diff with mouse wheelScroll
Open clicked line in editorFocus and selection stay put, so it works while reading a diff from another panel.Alt+ClickorShift+Click

Merge conflicts 8

ActionShortcut
Pick hunkKeeps the highlighted side of the conflict.Space
Pick both hunksKeeps both sides of the conflict.b
Previous hunkUpork
Next hunkDownorj
Previous conflictLeftorh
Next conflictRightorl
Undo conflict resolutionTakes back the last hunk pick made here.z
Return to files panelEsc

Branches 21

ActionShortcut
Check out branchSpace
Checkout by nameType a branch name; entering - switches to the previous branch.c
Checkout previous branch-
Force checkoutThrows away every local change of the working directory, then switches to the selected branch.F
New branchn
Move commits onto new branchTakes the current branch's unpushed commits, whatever is selected; meant for work started on the wrong branch.N
Rename branchR
Delete branchOpens the delete choices for the local or the remote branch.d
Rebase onto selected branchIt is the checked-out branch that gets rebased, not the selected one.r
Merge into current branchOffers a regular merge or a squash merge of the selected branch.M
Fast-forwardBrings the selected branch up to date with its upstream branch.f
View upstream optionsSet or unset the upstream of the branch, or reset the branch to it.u
New tagT
Sort orders
Show git-flow optionsNeeds Gitflow or git-flow-next to be installed.i
Create pull requesto
Pull request creation optionsO
Open pull request in the browserThe Commits panel has this key as well.G
Copy pull request URLCtrl+Y
Copy branch nameCtrl+O
View commitsLists the commits of the selected branch; remote branches, tags and reflog entries open likewise.Enter

Remotes and remote branches 9

Remote branches also take the Branches keys for new branch, merge, rebase, sort order and viewing commits.

ActionShortcut
View remote branchesEnter
New remoten
Remove remoteLocal branches that track branches of this remote are left alone.d
Edit remoteChanges the name or the URL of the selected remote.e
Fetch remoteDownloads what is new on that remote; nothing gets merged into local branches.f
Add fork remoteBuilds the fork's address from origin with another owner and can check out one of its branches.F
Check out remote branchCreates a local branch based on it, or checks it out as a detached head.Space
Delete remote branchRemoves the branch on the remote itself.d
Set as upstreamThe branch you have checked out will track the selected remote branch.u

Tags 5

ActionShortcut
Check out tagLeaves the repository on a detached HEAD at that tag.Space
New tagTags the current commit; a prompt asks for the name and an optional description.n
Delete tagOpens the delete choices for the local or the remote tag.d
Push tagAsks which remote should receive the selected tag.P
Copy tag nameCtrl+O

Commits 34

The Reflog and Sub-commits panels take the Commits keys for checkout, copying a hash or attribute, opening in the browser, new branch, reset, cherry-pick copy and selecting the commits of the current branch.

ActionShortcut
Check out commitLeaves you on a detached HEAD; reflog entries and sub-commits behave alike.Space
View commit filesLists the files the commit changed; stash entries and sub-commits open likewise.Enter
SquashFolds the selected commit into the one below and appends its message there.s
FixupLike squash, except that the folded commit's message is thrown away.f
Set fixup messageChooses which message the fixup keeps, such as this commit's rather than the target's.c
RewordEdits the message of the selected commit.r
Reword with editorR
DropRemoves the commit through a rebase; later commits that depend on it may conflict.d
Edit commitStarts an interactive rebase at this commit; mid-rebase it marks the commit so the rebase pauses there.e
Start interactive rebaseCovers the branch from HEAD down to the first merge or main-branch commit.i
PickDuring a rebase, marks the commit to be kept once the rebase continues.p
Move commit downCtrl+JorAlt+Down
Move commit upCtrl+KorAlt+Up
Create fixup commitThe new fixup! commit targets the selection and is squashed in later with S.F
Apply fixup commitsAutosquash: melds every fixup! commit over the selection, or of the whole branch, into its target.S
Amend selected commitAdds what is staged: git commit --amend on HEAD, a background rebase for an older commit.A
Amend commit attributeOpens a menu for resetting or setting the author and adding a co-author.a
Reset commit authorathena
Set commit authorathenA
Add co-authorathenc
RevertCreates a new commit that undoes what the selected one changed.t
Copy commit for cherry-pickMarks the commit as copied; paste with V and clear the marks with Esc.C
Paste commitsCherry-picks the commits copied with C onto the checked-out branch.V
Reset cherry-pick selectionClears the marks on commits that were copied.Ctrl+R
Mark base commit for rebaseOnly commits above the mark are carried over by the next rebase onto another branch.B
Tag commitPrompts for a tag name and an optional description.T
New branch from commitn
View reset optionsSoft, mixed or hard reset onto the selected item; branches, tags and reflog entries offer it too.g
View bisect optionsMark the selected commit good or bad to begin a git bisect.b
View log optionsChange the sort order, hide the git graph or show the whole graph.Ctrl+L
Select current branch's commits*
Copy commit attributeOffers the hash, URL, diff, message or author for copying.y
Open commit in browsero
Copy abbreviated commit hashCtrl+O

Commit files and custom patches 5

ActionShortcut
Check out file from commitReplaces the working-tree file with the one stored by the selected commit.c
Remove file changes from commitRewrites the commit through a background rebase, which can conflict with later commits touching the file.d
Toggle file in custom patchAdds the file to the custom patch or takes it out again.Space
Toggle all files in patchAdds or removes every file of the commit in one step.a
View custom patch optionsGlobal key; use it once files or hunks of a commit are in the patch.Ctrl+P

Stash 5

ActionShortcut
Apply stash entryApplies it to the working directory; the entry stays on the stash list.Space
Pop stash entryApplies it and then deletes it from the stash list.g
Drop stash entryd
New branch from stash entryBranches at the commit the stash was made on and applies the stash there as a commit.n
Rename stashr

Submodules 8

ActionShortcut
Enter submoduleOpens the submodule as a repository; Esc goes back to the parent repo.Enter
New submodulen
Initialize submodulePrepares it for fetching; run the update key afterwards to get its contents.i
Update submoduleu
Update submodule URLe
Remove submoduleDeletes the submodule together with its directory.d
View bulk submodule optionsb
Copy submodule nameCtrl+O

Worktrees 5

ActionShortcut
New worktreen
Create worktree from selectionOffered on branches, commits, reflog entries, stash entries and tags; from a branch it also switches to the worktree.w
Switch to worktreeSpace
Open worktree in editoro
Remove worktreeDeletes its directory and the metadata git keeps about it under .git.d

Command-line options 14

ActionShortcut
Open repository at pathStands for passing both --work-tree and --git-dir for that repository.-p / --path
Filter commits by pathOnly commits, reflog entries and stashes touching the path are listed, as with lazygit -f my/path.-f / --filter
Open with a panel focusedThe argument may be status, branch, log or stash; a filter path overrides it.lazygit status
Set initial screen modeTakes normal (the default), half or full, which sets how large the focused panel is.-sm / --screen-mode
Set work treePassed on as git's own work-tree argument.-w / --work-tree
Set git directoryPassed on as git's own git-dir argument.-g / --git-dir
Use custom config filesTakes a comma-separated list; the LG_CONFIG_FILE variable does the same.-ucf / --use-config-file
Use another config directory-ucd / --use-config-dir
Print config directory-cd / --print-config-dir
Print default config-c / --config
Print version-v / --version
Run in debug modeLogs while running; the LOG_LEVEL variable picks debug, info, warn or error.-d / --debug
Tail lazygit logsMeant for a second terminal tab while a debug-mode lazygit runs in the first.-l / --logs
Show command-line help--help

Notes

The commit loop

In the Files panel, Space stages or unstages the highlighted file and a toggles every file at once; Enter focuses the file's diff so individual hunks can be staged with the same Space key, and a there switches to line-by-line selection. c commits with a message typed in lazygit, C opens your git editor for a longer one, and A amends the last commit. p pulls and P pushes; both are global keys, although the Tags panel uses P to push the selected tag. d opens the discard options for a file, and s stashes all changes.

Rewriting history without typing rebase commands

In the Commits panel, Ctrl + J and Ctrl + K move a commit down or up, which is an interactive rebase without the todo file. F creates a fixup commit for the highlighted commit and S squashes the fixup commits in; from the Files panel, Ctrl + F finds the commit your current changes build on. t reverts, T tags, g opens the reset options for the commit, and N moves the branch's unpushed commits to a new branch, whatever is selected. z undoes the last git command by reading the reflog, which is the safety net for all of the above, though it does not bring back changes to the working tree.

Seeing what happened

v starts a range selection so several files or commits can be acted on at once. W opens diffing options to compare two refs, Ctrl + W hides whitespace changes, and } and { widen or narrow the diff context. @ opens the command log options, where the log of git commands lazygit has run on your behalf can be shown, hidden or focused; it is the fastest way to learn what a key actually does under the hood. + cycles the screen modes normal, half and fullscreen to give the focused panel more room.

Questions

How do I stage part of a file?

Press Enter on the file to focus its diff. The selection starts as a whole hunk, so Space stages that hunk; press a first for line-by-line selection, or v to select a range of lines.

Can I undo a rebase or reset I did in lazygit?

Press z. Lazygit reads the reflog to work out which git command reverses the last one; Z redoes. Only commits are covered, not changes to the working tree.

How do I see the git commands lazygit is running?

Press @ to open the command log options and view the log panel.

Why does the same key do different things?

Keys are scoped to the focused panel. Press ? in any panel for its bindings, or Tab to move to the next side panel.

Which lazygit keys are different on macOS?

Only a few text-input defaults: moving the cursor by word and deleting a word use Alt on macOS and Ctrl on Linux and Windows. Lazygit picks the set from the system it runs on, and the LAZYGIT_KEYBINDING_PLATFORM environment variable overrides that choice.

Sources and checks

Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.

Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.