diff --git a/docs/Config.md b/docs/Config.md index d28f39bf0..7cd142f69 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -128,6 +128,7 @@ Default path for the config file: tagCommit: 'T' toggleDiffCommit: 'i' checkoutCommit: '' + resetCherryPick: '' stash: popStash: 'g' commitFiles: diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index deb5a9bd3..eed4e7da4 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -360,6 +360,7 @@ keybinding: tagCommit: 'T' toggleDiffCommit: 'i' checkoutCommit: '' + resetCherryPick: '' stash: popStash: 'g' commitFiles: diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 8baa5c9e5..a5e864dc9 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -642,3 +642,8 @@ func (gui *Gui) handleOpenSearchForCommitsPanel(g *gocui.Gui, v *gocui.View) err return gui.handleOpenSearch(gui.g, v) } + +func (gui *Gui) handleResetCherryPick(g *gocui.Gui, v *gocui.View) error { + gui.State.CherryPickedCommits = []*commands.Commit{} + return gui.refreshCommits(gui.g) +} diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 3f965f2f6..501f1faea 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -840,6 +840,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Handler: gui.handleTagCommit, Description: gui.Tr.SLocalize("tagCommit"), }, + { + ViewName: "commits", + Contexts: []string{"branch-commits"}, + Key: gui.getKey("commits.resetCherryPick"), + Modifier: gocui.ModNone, + Handler: gui.handleResetCherryPick, + Description: gui.Tr.SLocalize("resetCherryPick"), + }, { ViewName: "commits", Contexts: []string{"reflog-commits"}, diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index c17cd753d..13f617264 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -1032,6 +1032,9 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "closeMenu", Other: "close menu", + }, &i18n.Message{ + ID: "resetCherryPick", + Other: "reset cherry-picked (copied) commits selection", }, ) }