diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-02-16 09:05:15 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-02-16 09:57:49 +1100 |
commit | 8ca9f93ccf9faafa776264be06520b8199fe9162 (patch) | |
tree | 1c57f04260adc4238b90fe2dd4011ecfef26b9e9 /pkg | |
parent | 73d806483747f898bdfc1c7911253cd62092dc42 (diff) |
allow resetting to remote branch
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/keybindings.go | 8 | ||||
-rw-r--r-- | pkg/gui/remote_branches_panel.go | 9 |
2 files changed, 17 insertions, 0 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 7d79fc3b0..0afd63a26 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -599,6 +599,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { }, { 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"}, Key: gui.getKey("branches.fetchRemote"), Modifier: gocui.ModNone, diff --git a/pkg/gui/remote_branches_panel.go b/pkg/gui/remote_branches_panel.go index fbe299fd9..858252f82 100644 --- a/pkg/gui/remote_branches_panel.go +++ b/pkg/gui/remote_branches_panel.go @@ -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)) +} |