1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-17 21:18:31 +02:00

allow resetting to remote branch

This commit is contained in:
Jesse Duffield 2020-02-16 09:05:15 +11:00
parent 73d8064837
commit 8ca9f93ccf
2 changed files with 17 additions and 0 deletions

View File

@ -597,6 +597,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
Handler: gui.handleRemoteBranchesEscape,
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",
Contexts: []string{"remotes"},

View File

@ -132,3 +132,12 @@ func (gui *Gui) handleSetBranchUpstream(g *gocui.Gui, v *gocui.View) error {
return gui.refreshSidePanels(gui.g)
}, 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))
}