mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	Add undo demo
This commit is contained in:
		
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
								
							| @@ -129,6 +129,21 @@ Learn more in the [Rebase magic Youtube tutorial](https://youtu.be/4XaToVut_hs). | ||||
|  | ||||
|  | ||||
|  | ||||
| ### 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) | ||||
|  | ||||
|  | ||||
|  | ||||
| ### 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. | ||||
|  | ||||
|  | ||||
|  | ||||
| ## Tutorials | ||||
|  | ||||
| [<img src="https://i.imgur.com/sVEktDn.png">](https://youtu.be/CPLdltN7wgE) | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| # Undo/Redo in lazygit | ||||
|  | ||||
|  | ||||
| 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: | ||||
| 'z' to undo, 'ctrl+z' to redo | ||||
|  | ||||
|  | ||||
| ## How it works | ||||
|  | ||||
|   | ||||
| @@ -5,8 +5,6 @@ import ( | ||||
| 	. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||||
| ) | ||||
|  | ||||
| // TODO: fix confirmation view wrapping issue: https://github.com/jesseduffield/lazygit/issues/2872 | ||||
|  | ||||
| var Undo = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Description:  "Undo", | ||||
| 	ExtraCmdArgs: []string{}, | ||||
| @@ -38,14 +36,6 @@ var Undo = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 				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(). | ||||
| 			SetCaptionPrefix("Drop two commits"). | ||||
| 			Wait(1000). | ||||
| @@ -58,12 +48,6 @@ var Undo = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 			Press(keys.Universal.Undo). | ||||
| 			Tap(confirmUndo). | ||||
| 			Press(keys.Universal.Undo). | ||||
| 			Tap(confirmUndo). | ||||
| 			SetCaptionPrefix("Redo the drops"). | ||||
| 			Wait(1000). | ||||
| 			Press(keys.Universal.Redo). | ||||
| 			Tap(confirmRedo). | ||||
| 			Press(keys.Universal.Redo). | ||||
| 			Tap(confirmRedo) | ||||
| 			Tap(confirmUndo) | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user