Lazygit/Keyshort/Undo and Redo
- Keyshort Lazygit Lazygit/Keyshort
- Undo the Last Git Command Card
- Shortcut:
z - Description: Reads git/reflog to work out which git command ran last and what would reverse it, then prompts before running it.
- Shortcut:
- Redo the Undone Command Card
- Shortcut:
Z - Description: Uppercase
Z, also driven by the git/reflog. Not<C-z>— that suspends lazygit to the shell, which is what several cheat sheets get wrong.
- Shortcut:
- My Note
- Only commits are considered. Working-tree changes are outside the reflog, so an undo will not bring back a discarded hunk — that is what Lazygit/Keyshort/Discard Change warns about.
- The reflog basis is the same mechanism that made a rewritten commit recoverable in Lazygit/26/04/24 Fri Issues with git merge conflict resolution;
4]browses it directly (see Lazygit/Keyshort/Show Reflog).
- Undo the Last Git Command Card