mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-19 12:12:42 +02:00
Add worktree demo
This commit is contained in:
parent
096628e366
commit
996ad5bf26
@ -113,6 +113,14 @@ Lazygit has a very flexible [custom command system](docs/Custom_Command_Keybindi
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
### Worktrees
|
||||||
|
|
||||||
|
You can create worktrees to have multiple branches going at once without the need for stashing or creating WIP commits when switching between them. Press `w` in the branches view to create a worktree from the selected branch and switch to it.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Rebase magic (custom patches)
|
||||||
|
|
||||||
## 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)
|
||||||
|
59
pkg/integration/tests/demo/worktree_create_from_branches.go
Normal file
59
pkg/integration/tests/demo/worktree_create_from_branches.go
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package demo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var WorktreeCreateFromBranches = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Create a worktree from the branches view",
|
||||||
|
ExtraCmdArgs: []string{},
|
||||||
|
Skip: false,
|
||||||
|
IsDemo: true,
|
||||||
|
SetupConfig: func(cfg *config.AppConfig) {
|
||||||
|
// No idea why I had to use version 2: it should be using my own computer's
|
||||||
|
// font and the one iterm uses is version 3.
|
||||||
|
cfg.UserConfig.Gui.NerdFontsVersion = "2"
|
||||||
|
},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.CreateNCommitsWithRandomMessages(30)
|
||||||
|
shell.NewBranch("feature/user-authentication")
|
||||||
|
shell.EmptyCommit("Add user authentication feature")
|
||||||
|
shell.EmptyCommit("Fix local session storage")
|
||||||
|
shell.CreateFile("src/authentication.go", "package main")
|
||||||
|
shell.CreateFile("src/shims.go", "package main")
|
||||||
|
shell.CreateFile("src/session.go", "package main")
|
||||||
|
shell.EmptyCommit("Stop using shims")
|
||||||
|
shell.UpdateFile("src/authentication.go", "package authentication")
|
||||||
|
shell.UpdateFileAndAdd("src/shims.go", "// removing for now")
|
||||||
|
shell.UpdateFile("src/session.go", "package session")
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.SetCaptionPrefix("Create a worktree from a branch")
|
||||||
|
t.Wait(1000)
|
||||||
|
|
||||||
|
t.Views().Branches().
|
||||||
|
Focus().
|
||||||
|
NavigateToLine(Contains("master")).
|
||||||
|
Wait(500).
|
||||||
|
Press(keys.Worktrees.ViewWorktreeOptions).
|
||||||
|
Tap(func() {
|
||||||
|
t.Wait(500)
|
||||||
|
|
||||||
|
t.ExpectPopup().Menu().
|
||||||
|
Title(Equals("Worktree")).
|
||||||
|
Select(Contains("Create worktree from master").DoesNotContain("detached")).
|
||||||
|
Confirm()
|
||||||
|
|
||||||
|
t.ExpectPopup().Prompt().
|
||||||
|
Title(Equals("New worktree path")).
|
||||||
|
Type("../hotfix").
|
||||||
|
Confirm()
|
||||||
|
|
||||||
|
t.ExpectPopup().Prompt().
|
||||||
|
Title(Contains("New branch name")).
|
||||||
|
Type("hotfix/db-on-fire").
|
||||||
|
Confirm()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
@ -99,6 +99,7 @@ var tests = []*components.IntegrationTest{
|
|||||||
demo.NukeWorkingTree,
|
demo.NukeWorkingTree,
|
||||||
demo.StageLines,
|
demo.StageLines,
|
||||||
demo.Undo,
|
demo.Undo,
|
||||||
|
demo.WorktreeCreateFromBranches,
|
||||||
diff.Diff,
|
diff.Diff,
|
||||||
diff.DiffAndApplyPatch,
|
diff.DiffAndApplyPatch,
|
||||||
diff.DiffCommits,
|
diff.DiffCommits,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user