diff --git a/pkg/gui/controllers/commits_files_controller.go b/pkg/gui/controllers/commits_files_controller.go index e8dbca90d..1412254e7 100644 --- a/pkg/gui/controllers/commits_files_controller.go +++ b/pkg/gui/controllers/commits_files_controller.go @@ -351,6 +351,13 @@ func (self *CommitFilesController) canDiscardFileChanges(nodes []*filetree.Commi } } + if self.c.Contexts().LocalCommits.AreMultipleItemsSelected() { + return &types.DisabledReason{ + Text: self.c.Tr.CannotDiscardFromMultipleCommits, + ShowErrorInPanel: true, + } + } + if self.c.Git().Status.WorkingTreeState().Any() { return &types.DisabledReason{ Text: self.c.Tr.CantPatchWhileRebasingError, diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index e8f5b50f7..8d66d546a 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -434,6 +434,7 @@ type TranslationSet struct { CheckoutCommitFileTooltip string CannotCheckoutWithModifiedFilesErr string CanOnlyDiscardFromLocalCommits string + CannotDiscardFromMultipleCommits string Remove string DiscardOldFileChangeTooltip string DiscardFileChangesTitle string @@ -1543,6 +1544,7 @@ func EnglishTranslationSet() *TranslationSet { CheckoutCommitFileTooltip: "Checkout file. This replaces the file in your working tree with the version from the selected commit.", CannotCheckoutWithModifiedFilesErr: "You have local modifications for the file(s) you are trying to check out. You need to stash or discard these first.", CanOnlyDiscardFromLocalCommits: "Changes can only be discarded from local commits", + CannotDiscardFromMultipleCommits: "Changes cannot be discarded from a multiselection of commits", Remove: "Remove", DiscardOldFileChangeTooltip: "Discard this commit's changes to this file. This runs an interactive rebase in the background, so you may get a merge conflict if a later commit also changes this file.", DiscardFileChangesTitle: "Discard file changes",