Back to Lazygit

Lazygit Keybindings

docs-master/keybindings/Keybindings_en.md

0.61.125.8 KB
Original Source

This file is auto-generated. To update, make the changes in the pkg/i18n directory and then run go generate ./... from the project root.

Lazygit Keybindings

Legend: <c-b> means ctrl+b, <a-b> means alt+b, B means shift+b

Global keybindings

KeyActionInfo
<c-r>Switch to a recent repo
<pgup> (fn+up/shift+k)Scroll up main window
<pgdown> (fn+down/shift+j)Scroll down main window
@View command log optionsView options for the command log e.g. show/hide the command log and focus the command log.
PPushPush the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch.
pPullPull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch.
)Increase rename similarity thresholdIncrease the similarity threshold for a deletion and addition pair to be treated as a rename.

The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. | | ( | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename.

The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. | | } | Increase diff context size | Increase the amount of the context shown around changes in the diff view.

The default can be changed in the config file with the key 'git.diffContextSize'. | | { | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view.

The default can be changed in the config file with the key 'git.diffContextSize'. | | : | Execute shell command | Bring up a prompt where you can enter a shell command to execute. | | <c-p> | View custom patch options | | | m | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. | | R | Refresh | Refresh the git state (i.e. run git status, git branch, etc in background to update the contents of panels). This does not run git fetch. | | + | Next screen mode (normal/half/fullscreen) | | | _ | Prev screen mode | | | \| | Cycle pagers | Choose the next pager in the list of configured pagers | | <esc> | Cancel | | | ? | Open keybindings menu | | | <c-s> | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. | | W | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | <c-e> | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | q | Quit | | | <c-z> | Suspend the application | | | <c-w> | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | z | Undo | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. | | Z | Redo | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |

List panel navigation

KeyActionInfo
,Previous page
.Next page
< (<home>)Scroll to top
> (<end>)Scroll to bottom
vToggle range select
<s-down>Range select down
<s-up>Range select up
/Search the current view by text
HScroll left
LScroll right
]Next tab
[Previous tab

Commit files

KeyActionInfo
<c-o>Copy path to clipboard
yCopy to clipboard
cCheckoutCheckout file. This replaces the file in your working tree with the version from the selected commit.
dDiscardDiscard this commit's changes to this file. This runs an interactive rebase in the background, so you may get a merge conflict if a later commit also changes this file.
oOpen fileOpen file in default application.
eEditOpen file in external editor.
<c-t>Open external diff tool (git difftool)
<space>Toggle file included in patchToggle whether the file is included in the custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches.
aToggle all filesAdd/remove all commit's files to custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches.
<enter>Enter file / Toggle directory collapsedIf a file is selected, enter the file so that you can add/remove individual lines to the custom patch. If a directory is selected, toggle the directory.
`Toggle file tree viewToggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.

The default can be changed in the config file with the key 'gui.showFileTree'. | | - | Collapse all files | Collapse all directories in the files tree | | = | Expand all files | Expand all directories in the file tree | | 0 | Focus main view | | | / | Filter the current view by text | |

Commit summary

KeyActionInfo
<enter>Confirm
<esc>Close

Commits

KeyActionInfo
<c-o>Copy abbreviated commit hash to clipboard
<c-r>Reset copied (cherry-picked) commits selection
bView bisect options
sSquashSquash the selected commit into the commit below it. The selected commit's message will be appended to the commit below it.
fFixupMeld the selected commit into the commit below it. Similar to squash, but the selected commit's message will be discarded.
cSet fixup messageSet the message option for the fixup commit. The -C option means to use this commit's message instead of the target commit's message.
rRewordReword the selected commit's message.
RReword with editor
dDropDrop the selected commit. This will remove the commit from the branch via a rebase. If the commit makes changes that later commits depend on, you may need to resolve merge conflicts.
eEdit (start interactive rebase)Edit the selected commit. Use this to start an interactive rebase from the selected commit. When already mid-rebase, this will mark the selected commit for editing, which means that upon continuing the rebase, the rebase will pause at the selected commit to allow you to make changes.
iStart interactive rebaseStart an interactive rebase for the commits on your branch. This will include all commits from the HEAD commit down to the first merge commit or main branch commit.
If you would instead like to start an interactive rebase from the selected commit, press e.
pPickMark the selected commit to be picked (when mid-rebase). This means that the commit will be retained upon continuing the rebase.
FCreate fixup commitCreate 'fixup!' commit for the selected commit. Later on, you can press S on this same commit to apply all above fixup commits.
SApply fixup commitsSquash all 'fixup!' commits, either above the selected commit, or all in current branch (autosquash).
<c-j>Move commit down one
<c-k>Move commit up one
VPaste (cherry-pick)
BMark as base commit for rebaseSelect a base commit for the next rebase. When you rebase onto a branch, only commits above the base commit will be brought across. This uses the git rebase --onto command.
AAmendAmend commit with staged changes. If the selected commit is the HEAD commit, this will perform git commit --amend. Otherwise the commit will be amended via a rebase.
aAmend commit attributeSet/Reset commit author or set co-author.
tRevertCreate a revert commit for the selected commit, which applies the selected commit's changes in reverse.
TTag commitCreate a new tag pointing at the selected commit. You'll be prompted to enter a tag name and optional description.
<c-l>View log optionsView options for commit log e.g. changing sort order, hiding the git graph, showing the whole git graph.
GOpen pull request in browser
<space>CheckoutCheckout the selected commit as a detached HEAD.
yCopy commit attribute to clipboardCopy commit attribute to clipboard (e.g. hash, URL, diff, message, author).
oOpen commit in browser
nCreate new branch off of commit
NMove commits to new branchCreate a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.

Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). | | g | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. | | C | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press V to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press <esc> to cancel the selection. | | <c-t> | Open external diff tool (git difftool) | | | * | Select commits of current branch | | | 0 | Focus main view | | | <enter> | View files | | | w | View worktree options | | | / | Search the current view by text | |

Confirmation panel

KeyActionInfo
<enter>Confirm
<esc>Close/Cancel
<c-o>Copy to clipboard

Files

KeyActionInfo
<c-o>Copy path to clipboard
<space>StageToggle staged for selected file.
<c-b>Filter files by status
yCopy to clipboard
cCommitCommit staged changes.
wCommit changes without pre-commit hook
AAmend last commit
CCommit changes using git editor
<c-f>Find base commit for fixupFind the commit that your current changes are building upon, for the sake of amending/fixing up the commit. This spares you from having to look through your branch's commits one-by-one to see which commit should be amended/fixed up. See docs: https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md
eEditOpen file in external editor.
oOpen fileOpen file in default application.
iIgnore or exclude file
rRefresh files
sStashStash all changes. For other variations of stashing, use the view stash options keybinding.
SView stash optionsView stash options (e.g. stash all, stash staged, stash unstaged).
aStage allToggle staged/unstaged for all files in working tree.
<enter>Stage lines / Collapse directoryIf the selected item is a file, focus the staging view so you can stage individual hunks/lines. If the selected item is a directory, collapse/expand it.
dDiscardView options for discarding changes to the selected file.
gView upstream reset options
DResetView reset options for working tree (e.g. nuking the working tree).
`Toggle file tree viewToggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.

The default can be changed in the config file with the key 'gui.showFileTree'. | | <c-t> | Open external diff tool (git difftool) | | | M | View merge conflict options | View options for resolving merge conflicts. | | f | Fetch | Fetch changes from remote. | | - | Collapse all files | Collapse all directories in the files tree | | = | Expand all files | Expand all directories in the file tree | | 0 | Focus main view | | | / | Filter the current view by text | |

Input prompt

KeyActionInfo
<enter>Confirm
<esc>Close/Cancel

Local branches

KeyActionInfo
<c-o>Copy branch name to clipboard
iShow git-flow options
<space>CheckoutCheckout selected item.
nNew branch
NMove commits to new branchCreate a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.

Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). | | o | Create pull request | | | O | View create pull request options | | | G | Open pull request in browser | | | <c-y> | Copy pull request URL to clipboard | | | c | Checkout by name | Checkout by name. In the input box you can enter '-' to switch to the previous branch. | | - | Checkout previous branch | | | F | Force checkout | Force checkout selected branch. This will discard all local changes in your working directory before checking out the selected branch. | | d | Delete | View delete options for local/remote branch. | | r | Rebase | Rebase the checked-out branch onto the selected branch. | | M | Merge | View options for merging the selected item into the current branch (regular merge, squash merge) | | f | Fast-forward | Fast-forward selected branch from its upstream. | | T | New tag | | | s | Sort order | | | g | Reset | | | R | Rename branch | | | u | View upstream options | View options relating to the branch's upstream e.g. setting/unsetting the upstream and resetting to the upstream. | | <c-t> | Open external diff tool (git difftool) | | | 0 | Focus main view | | | <enter> | View commits | | | w | View worktree options | | | / | Filter the current view by text | |

Main panel (merging)

KeyActionInfo
<space>Pick hunk
bPick all hunks
<up>Previous hunk
<down>Next hunk
<left>Previous conflict
<right>Next conflict
zUndoUndo last merge conflict resolution.
eEdit fileOpen file in external editor.
oOpen fileOpen file in default application.
MView merge conflict optionsView options for resolving merge conflicts.
<esc>Return to files panel

Main panel (normal)

KeyActionInfo
mouse wheel down (fn+up)Scroll down
mouse wheel up (fn+down)Scroll up
<tab>Switch viewSwitch to other view (staged/unstaged changes).
<esc>Exit back to side panel
/Search the current view by text

Main panel (patch building)

KeyActionInfo
<left>Go to previous hunk
<right>Go to next hunk
vToggle range select
aToggle hunk selectionToggle line-by-line vs. hunk selection mode.
<c-o>Copy selected text to clipboard
oOpen fileOpen file in default application.
eEdit fileOpen file in external editor.
<space>Toggle lines in patch
dRemove lines from commitRemove the selected lines from this commit. This runs an interactive rebase in the background, so you may get a merge conflict if a later commit also changes these lines.
<esc>Exit custom patch builder
/Search the current view by text

Main panel (staging)

KeyActionInfo
<left>Go to previous hunk
<right>Go to next hunk
vToggle range select
aToggle hunk selectionToggle line-by-line vs. hunk selection mode.
<c-o>Copy selected text to clipboard
<space>StageToggle selection staged / unstaged.
dDiscardWhen unstaged change is selected, discard the change using git reset. When staged change is selected, unstage the change.
oOpen fileOpen file in default application.
eEdit fileOpen file in external editor.
<esc>Return to files panel
<tab>Switch viewSwitch to other view (staged/unstaged changes).
EEdit hunkEdit selected hunk in external editor.
cCommitCommit staged changes.
wCommit changes without pre-commit hook
CCommit changes using git editor
<c-f>Find base commit for fixupFind the commit that your current changes are building upon, for the sake of amending/fixing up the commit. This spares you from having to look through your branch's commits one-by-one to see which commit should be amended/fixed up. See docs: https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md
/Search the current view by text
KeyActionInfo
<enter>Execute
<esc>Close/Cancel
/Filter the current view by text

Reflog

KeyActionInfo
<c-o>Copy abbreviated commit hash to clipboard
<space>CheckoutCheckout the selected commit as a detached HEAD.
yCopy commit attribute to clipboardCopy commit attribute to clipboard (e.g. hash, URL, diff, message, author).
oOpen commit in browser
nCreate new branch off of commit
NMove commits to new branchCreate a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.

Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). | | g | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. | | C | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press V to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press <esc> to cancel the selection. | | <c-r> | Reset copied (cherry-picked) commits selection | | | <c-t> | Open external diff tool (git difftool) | | | * | Select commits of current branch | | | 0 | Focus main view | | | <enter> | View commits | | | w | View worktree options | | | / | Filter the current view by text | |

Remote branches

KeyActionInfo
<c-o>Copy branch name to clipboard
<space>CheckoutCheckout a new local branch based on the selected remote branch, or the remote branch as a detached head.
nNew branch
MMergeView options for merging the selected item into the current branch (regular merge, squash merge)
rRebaseRebase the checked-out branch onto the selected branch.
dDeleteDelete the remote branch from the remote.
uSet as upstreamSet the selected remote branch as the upstream of the checked-out branch.
sSort order
gResetView reset options (soft/mixed/hard) for resetting onto selected item.
<c-t>Open external diff tool (git difftool)
0Focus main view
<enter>View commits
wView worktree options
/Filter the current view by text

Remotes

KeyActionInfo
<enter>View branches
nNew remote
dRemoveRemove the selected remote. Any local branches tracking a remote branch from the remote will be unaffected.
eEditEdit the selected remote's name or URL.
fFetchFetch updates from the remote repository. This retrieves new commits and branches without merging them into your local branches.
FAdd fork remoteQuickly add a fork remote by replacing the owner in the origin URL and optionally check out a branch from new remote.
/Filter the current view by text

Secondary

KeyActionInfo
<tab>Switch viewSwitch to other view (staged/unstaged changes).
<esc>Exit back to side panel
/Search the current view by text

Stash

KeyActionInfo
<space>ApplyApply the stash entry to your working directory.
gPopApply the stash entry to your working directory and remove the stash entry.
dDropRemove the stash entry from the stash list.
nNew branchCreate a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit.
rRename stash
0Focus main view
<enter>View files
wView worktree options
/Filter the current view by text

Status

KeyActionInfo
oOpen config fileOpen file in default application.
eEdit config fileOpen file in external editor.
uCheck for update
<enter>Switch to a recent repo
aShow/cycle all branch logs
AShow/cycle all branch logs (reverse)
0Focus main view

Sub-commits

KeyActionInfo
<c-o>Copy abbreviated commit hash to clipboard
<space>CheckoutCheckout the selected commit as a detached HEAD.
yCopy commit attribute to clipboardCopy commit attribute to clipboard (e.g. hash, URL, diff, message, author).
oOpen commit in browser
nCreate new branch off of commit
NMove commits to new branchCreate a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.

Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). | | g | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. | | C | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press V to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press <esc> to cancel the selection. | | <c-r> | Reset copied (cherry-picked) commits selection | | | <c-t> | Open external diff tool (git difftool) | | | * | Select commits of current branch | | | 0 | Focus main view | | | <enter> | View files | | | w | View worktree options | | | / | Search the current view by text | |

Submodules

KeyActionInfo
<c-o>Copy submodule name to clipboard
<enter>EnterEnter submodule. After entering the submodule, you can press <esc> to escape back to the parent repo.
dRemoveRemove the selected submodule and its corresponding directory.
uUpdateUpdate selected submodule.
nNew submodule
eUpdate submodule URL
iInitializeInitialize the selected submodule to prepare for fetching. You probably want to follow this up by invoking the 'update' action to fetch the submodule.
bView bulk submodule options
/Filter the current view by text

Tags

KeyActionInfo
<c-o>Copy tag to clipboard
<space>CheckoutCheckout the selected tag as a detached HEAD.
nNew tagCreate new tag from current commit. You'll be prompted to enter a tag name and optional description.
dDeleteView delete options for local/remote tag.
PPush tagPush the selected tag to a remote. You'll be prompted to select a remote.
gResetView reset options (soft/mixed/hard) for resetting onto selected item.
<c-t>Open external diff tool (git difftool)
0Focus main view
<enter>View commits
wView worktree options
/Filter the current view by text

Worktrees

KeyActionInfo
nNew worktree
<space>SwitchSwitch to the selected worktree.
oOpen in editor
dRemoveRemove the selected worktree. This will both delete the worktree's directory, as well as metadata about the worktree in the .git directory.
/Filter the current view by text