mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
Add new command "Checkout previous branch"
This commit is contained in:
@ -89,6 +89,11 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
|
||||
Description: self.c.Tr.CheckoutByName,
|
||||
Tooltip: self.c.Tr.CheckoutByNameTooltip,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Branches.CheckoutPreviousBranch),
|
||||
Handler: self.checkoutPreviousBranch,
|
||||
Description: self.c.Tr.CheckoutPreviousBranch,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Branches.ForceCheckoutBranch),
|
||||
Handler: self.forceCheckout,
|
||||
@ -483,6 +488,11 @@ func (self *BranchesController) forceCheckout() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BranchesController) checkoutPreviousBranch() error {
|
||||
self.c.LogAction(self.c.Tr.Actions.CheckoutBranch)
|
||||
return self.c.Helpers().Refs.CheckoutRef("-", types.CheckoutRefOptions{})
|
||||
}
|
||||
|
||||
func (self *BranchesController) checkoutByName() error {
|
||||
self.c.Prompt(types.PromptOpts{
|
||||
Title: self.c.Tr.BranchName + ":",
|
||||
|
Reference in New Issue
Block a user