diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 8fa6b83ca..e4e7a432f 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -428,3 +428,12 @@ func (gui *Gui) handlePrevBranchesTab(g *gocui.Gui, v *gocui.View) error { utils.ModuloWithWrap(v.TabIndex-1, len(v.Tabs)), ) } + +func (gui *Gui) handleCreateResetToBranchMenu(g *gocui.Gui, v *gocui.View) error { + branch := gui.getSelectedBranch() + if branch == nil { + return nil + } + + return gui.createResetMenu(branch.Name) +} diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index b5dc95820..7d79fc3b0 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -537,6 +537,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Handler: gui.handleFastForward, Description: gui.Tr.SLocalize("FastForward"), }, + { + ViewName: "branches", + Contexts: []string{"local-branches"}, + Key: gui.getKey("commits.viewResetOptions"), + Modifier: gocui.ModNone, + Handler: gui.handleCreateResetToBranchMenu, + Description: gui.Tr.SLocalize("resetToThisBranch"), + }, { ViewName: "branches", Contexts: []string{"tags"}, diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 2d7c40624..c010e2068 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -942,6 +942,9 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "IgnoreTrackedPrompt", Other: "Are you sure you want to ignore a tracked file?", + }, &i18n.Message{ + ID: "resetToThisBranch", + Other: "reset to the HEAD of this branch", }, ) }