mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-15 01:34:26 +02:00
allow resetting to remote branch
This commit is contained in:
@ -597,6 +597,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
Handler: gui.handleRemoteBranchesEscape,
|
Handler: gui.handleRemoteBranchesEscape,
|
||||||
Description: gui.Tr.SLocalize("ReturnToRemotesList"),
|
Description: gui.Tr.SLocalize("ReturnToRemotesList"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "branches",
|
||||||
|
Contexts: []string{"remote-branches"},
|
||||||
|
Key: gui.getKey("commits.viewResetOptions"),
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleCreateResetToRemoteBranchMenu,
|
||||||
|
Description: gui.Tr.SLocalize("resetToThisBranch"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{"remotes"},
|
Contexts: []string{"remotes"},
|
||||||
|
@ -132,3 +132,12 @@ func (gui *Gui) handleSetBranchUpstream(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return gui.refreshSidePanels(gui.g)
|
return gui.refreshSidePanels(gui.g)
|
||||||
}, nil)
|
}, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleCreateResetToRemoteBranchMenu(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
selectedBranch := gui.getSelectedRemoteBranch()
|
||||||
|
if selectedBranch == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return gui.createResetMenu(fmt.Sprintf("%s/%s", selectedBranch.RemoteName, selectedBranch.Name))
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user