1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-03 13:21:56 +02:00

Add undo demo

This commit is contained in:
Jesse Duffield 2023-08-07 10:53:31 +10:00
parent 0df5cb1286
commit 3ea81d4a6f
3 changed files with 19 additions and 20 deletions

View File

@ -129,6 +129,21 @@ Learn more in the [Rebase magic Youtube tutorial](https://youtu.be/4XaToVut_hs).
![custom_patch](../assets/demo/custom_patch-compressed.gif) ![custom_patch](../assets/demo/custom_patch-compressed.gif)
### Undo
You can undo the last action by pressing 'z' and redo with `ctrl+z`. Here we drop a couple of commits and then undo the actions.
Undo uses the reflog which is specific to commits and branches so we can't undo changes to the working tree or stash.
[More info](/docs/Undoing.md)
![undo](../assets/demo/undo-compressed.gif)
### Commit graph
When viewing the commit graph in an enlarged window (use `+` and `_` to cycle window sizes), the commit graph is shown. Colours correspond to the commit authors, and as you navigate down the graph, the parent commits of the selected commit are highlighted.
![commit_graph](../assets/demo/commit_graph-compressed.gif)
## Tutorials ## Tutorials
[<img src="https://i.imgur.com/sVEktDn.png">](https://youtu.be/CPLdltN7wgE) [<img src="https://i.imgur.com/sVEktDn.png">](https://youtu.be/CPLdltN7wgE)

View File

@ -1,9 +1,9 @@
# Undo/Redo in lazygit # Undo/Redo in lazygit
![Gif](../../assets/undo2.gif) You can undo the last action by pressing 'z' and redo with `ctrl+z`. Here we drop a couple of commits and then undo the actions.
Undo uses the reflog which is specific to commits and branches so we can't undo changes to the working tree or stash.
## Keybindings: ![undo](../../assets/demo/undo-compressed.gif)
'z' to undo, 'ctrl+z' to redo
## How it works ## How it works

View File

@ -5,8 +5,6 @@ import (
. "github.com/jesseduffield/lazygit/pkg/integration/components" . "github.com/jesseduffield/lazygit/pkg/integration/components"
) )
// TODO: fix confirmation view wrapping issue: https://github.com/jesseduffield/lazygit/issues/2872
var Undo = NewIntegrationTest(NewIntegrationTestArgs{ var Undo = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Undo", Description: "Undo",
ExtraCmdArgs: []string{}, ExtraCmdArgs: []string{},
@ -38,14 +36,6 @@ var Undo = NewIntegrationTest(NewIntegrationTestArgs{
Confirm() Confirm()
} }
confirmRedo := func() {
t.ExpectPopup().Confirmation().
Title(Equals("Redo")).
Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)).
Wait(500).
Confirm()
}
t.Views().Commits().Focus(). t.Views().Commits().Focus().
SetCaptionPrefix("Drop two commits"). SetCaptionPrefix("Drop two commits").
Wait(1000). Wait(1000).
@ -58,12 +48,6 @@ var Undo = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Universal.Undo). Press(keys.Universal.Undo).
Tap(confirmUndo). Tap(confirmUndo).
Press(keys.Universal.Undo). Press(keys.Universal.Undo).
Tap(confirmUndo). Tap(confirmUndo)
SetCaptionPrefix("Redo the drops").
Wait(1000).
Press(keys.Universal.Redo).
Tap(confirmRedo).
Press(keys.Universal.Redo).
Tap(confirmRedo)
}, },
}) })