mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
feat: add 'Remove worktree and branch' option when deleting a branch checked out by a worktree
When deleting a branch that is currently checked out by a worktree, users previously had to remove the worktree first, then delete the branch in a second step. This adds a new menu option that combines both operations into a single action. Closes #5205
This commit is contained in:
parent
b4f79851db
commit
1f7edd5efb
|
|
@ -240,6 +240,16 @@ func (self *BranchesHelper) promptWorktreeBranchDelete(selectedBranch *models.Br
|
|||
return self.worktreeHelper.Remove(worktree, false)
|
||||
},
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.RemoveWorktreeAndBranch,
|
||||
Tooltip: self.c.Tr.RemoveWorktreeTooltip,
|
||||
OnPress: func() error {
|
||||
if err := self.worktreeHelper.Remove(worktree, false); err != nil {
|
||||
return err
|
||||
}
|
||||
return self.c.Git().Branch.LocalDelete([]string{selectedBranch.Name}, true)
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -866,6 +866,7 @@ type TranslationSet struct {
|
|||
DetachWorktreeTooltip string
|
||||
Switching string
|
||||
RemoveWorktree string
|
||||
RemoveWorktreeAndBranch string
|
||||
RemoveWorktreeTitle string
|
||||
DetachWorktree string
|
||||
DetachingWorktree string
|
||||
|
|
@ -1990,6 +1991,7 @@ func EnglishTranslationSet() *TranslationSet {
|
|||
DetachWorktreeTooltip: "This will run `git checkout --detach` on the worktree so that it stops hogging the branch, but the worktree's working tree will be left alone.",
|
||||
Switching: "Switching",
|
||||
RemoveWorktree: "Remove worktree",
|
||||
RemoveWorktreeAndBranch: "Remove worktree and branch",
|
||||
RemoveWorktreeTitle: "Remove worktree",
|
||||
RemoveWorktreePrompt: "Are you sure you want to remove worktree '{{.worktreeName}}'?",
|
||||
ForceRemoveWorktreePrompt: "'{{.worktreeName}}' contains modified or untracked files, or submodules (or all of these). Are you sure you want to remove it?",
|
||||
|
|
|
|||
Loading…
Reference in a new issue