From e858bad3f809b193ddea7ebfba9384cf41a75423 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 11 Oct 2025 15:39:02 +0200 Subject: [PATCH] Fix lazygit getting unresponsive when pasting commits that become empty Whenever git returns the error "The previous cherry-pick is now empty", we would previously continue the rebase; this works for rebase because it behaves the same as "git rebase --skip" in this case. That's not true for cherry-pick though; if you continue a cherry-pick where the current commit is empty, it will return the same error again, causing lazygit to be stuck in an endless loop. Fix this by skipping instead of continuing; this shouldn't make a difference for rebase, but works for cherry-pick. Theoretically we could have a similar problem for revert (if you are trying to revert a commit that has already been undone through some other means); this should then be fixed in the same way with this change. However, the change is not relevant for revert because git returns a different error in this case. --- pkg/gui/controllers/helpers/merge_and_rebase_helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go index fbe59caa6..88166ec49 100644 --- a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go +++ b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go @@ -157,7 +157,7 @@ func (self *MergeAndRebaseHelper) CheckMergeOrRebaseWithRefreshOptions(result er } else if strings.Contains(result.Error(), "No changes - did you forget to use") { return self.genericMergeCommand(REBASE_OPTION_SKIP) } else if strings.Contains(result.Error(), "The previous cherry-pick is now empty") { - return self.genericMergeCommand(REBASE_OPTION_CONTINUE) + return self.genericMergeCommand(REBASE_OPTION_SKIP) } else if strings.Contains(result.Error(), "No rebase in progress?") { // assume in this case that we're already done return nil