From 7918858023ee8975d525d804d174b1b51dc32828 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 30 Mar 2026 18:23:43 +0200 Subject: [PATCH 1/3] Localize "Dropping stash" log This was forgotten in #4850. --- pkg/gui/controllers/stash_controller.go | 6 ++++-- pkg/i18n/english.go | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/gui/controllers/stash_controller.go b/pkg/gui/controllers/stash_controller.go index 7027cd5fe..20dc2826e 100644 --- a/pkg/gui/controllers/stash_controller.go +++ b/pkg/gui/controllers/stash_controller.go @@ -1,6 +1,8 @@ package controllers import ( + "fmt" + "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/style" @@ -129,7 +131,7 @@ func (self *StashController) handleStashApply(stashEntry *models.StashEntry) err func (self *StashController) handleStashPop(stashEntry *models.StashEntry) error { pop := func() error { self.c.LogAction(self.c.Tr.Actions.PopStash) - self.c.LogCommand("Popping stash "+stashEntry.Hash, false) + self.c.LogCommand(fmt.Sprintf(self.c.Tr.Log.PoppingStash, stashEntry.Hash), false) err := self.c.Git().Stash.Pop(stashEntry.Index) self.postStashRefresh() if err != nil { @@ -163,7 +165,7 @@ func (self *StashController) handleStashDrop(stashEntries []*models.StashEntry) HandleConfirm: func() error { self.c.LogAction(self.c.Tr.Actions.DropStash) for i := len(stashEntries) - 1; i >= 0; i-- { - self.c.LogCommand("Dropping stash "+stashEntries[i].Hash, false) + self.c.LogCommand(fmt.Sprintf(self.c.Tr.Log.DroppingStash, stashEntries[i].Hash), false) err := self.c.Git().Stash.Drop(stashEntries[i].Index) self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.STASH}}) if err != nil { diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 079f6c991..8d4ced26e 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -963,6 +963,8 @@ type Log struct { CreateFileWithContent string AppendingLineToFile string EditRebaseFromBaseCommit string + DroppingStash string + PoppingStash string } type Actions struct { @@ -2197,6 +2199,8 @@ func EnglishTranslationSet() *TranslationSet { CreateFileWithContent: "Creating file '{{.path}}'", AppendingLineToFile: "Appending '{{.line}}' to file '{{.filename}}'", EditRebaseFromBaseCommit: "Beginning interactive rebase from '{{.baseCommit}}' onto '{{.targetBranchName}}", + DroppingStash: "Dropping stash %s", + PoppingStash: "Popping stash %s", }, BreakingChangesTitle: "Breaking Changes", BreakingChangesMessage: `You are updating to a new version of lazygit which contains breaking changes. Please review the notes below and update your configuration if necessary. From 710a73e35150ff9e01fa82a5f124ebe558e020ee Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 30 Mar 2026 18:35:55 +0200 Subject: [PATCH 2/3] Add missing quote --- pkg/i18n/english.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 8d4ced26e..3ddf30ca2 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -2198,7 +2198,7 @@ func EnglishTranslationSet() *TranslationSet { Remove: "Removing '{{.filename}}'", CreateFileWithContent: "Creating file '{{.path}}'", AppendingLineToFile: "Appending '{{.line}}' to file '{{.filename}}'", - EditRebaseFromBaseCommit: "Beginning interactive rebase from '{{.baseCommit}}' onto '{{.targetBranchName}}", + EditRebaseFromBaseCommit: "Beginning interactive rebase from '{{.baseCommit}}' onto '{{.targetBranchName}}'", DroppingStash: "Dropping stash %s", PoppingStash: "Popping stash %s", }, From e4309f101c4c53a404750a1a848065861de8ce62 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 30 Mar 2026 18:39:28 +0200 Subject: [PATCH 3/3] Log hashes of local branches when deleting them This makes it easier to recover them if they were deleted accidentally. We only do this for local branches for now, we don't bother for remote branches; it would be trickier there, because the branch on the server might not actually point to the same hash as our local remote tracking branch does. --- pkg/gui/controllers/helpers/branches_helper.go | 16 ++++++++++++++++ pkg/i18n/english.go | 2 ++ 2 files changed, 18 insertions(+) diff --git a/pkg/gui/controllers/helpers/branches_helper.go b/pkg/gui/controllers/helpers/branches_helper.go index 5566dc40c..9748fecc5 100644 --- a/pkg/gui/controllers/helpers/branches_helper.go +++ b/pkg/gui/controllers/helpers/branches_helper.go @@ -43,6 +43,7 @@ func (self *BranchesHelper) ConfirmLocalDelete(branches []*models.Branch) error doDelete := func() error { return self.c.WithWaitingStatus(self.c.Tr.DeletingStatus, func(_ gocui.Task) error { self.c.LogAction(self.c.Tr.Actions.DeleteLocalBranch) + self.logBranchHashes(branches) branchNames := lo.Map(branches, func(branch *models.Branch, _ int) string { return branch.Name }) if err := self.c.Git().Branch.LocalDelete(branchNames, true); err != nil { return err @@ -178,6 +179,7 @@ func (self *BranchesHelper) ConfirmLocalAndRemoteDelete(branches []*models.Branc } self.c.LogAction(self.c.Tr.Actions.DeleteLocalBranch) + self.logBranchHashes(branches) branchNames := lo.Map(branches, func(branch *models.Branch, _ int) string { return branch.Name }) if err := self.c.Git().Branch.LocalDelete(branchNames, true); err != nil { return err @@ -257,6 +259,20 @@ func (self *BranchesHelper) allBranchesMerged(branches []*models.Branch) (bool, return allBranchesMerged, nil } +func (self *BranchesHelper) logBranchHashes(branches []*models.Branch) { + for _, branch := range branches { + msg := utils.ResolvePlaceholderString( + self.c.Tr.Log.DeletingBranch, + map[string]string{ + "branchName": branch.Name, + "hash": branch.CommitHash, + }, + ) + + self.c.LogCommand(msg, false) + } +} + func (self *BranchesHelper) deleteRemoteBranches(remoteBranches []*models.RemoteBranch, task gocui.Task) error { remotes := lo.GroupBy(remoteBranches, func(branch *models.RemoteBranch) string { return branch.RemoteName }) for remote, branches := range remotes { diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 3ddf30ca2..002adb114 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -965,6 +965,7 @@ type Log struct { EditRebaseFromBaseCommit string DroppingStash string PoppingStash string + DeletingBranch string } type Actions struct { @@ -2201,6 +2202,7 @@ func EnglishTranslationSet() *TranslationSet { EditRebaseFromBaseCommit: "Beginning interactive rebase from '{{.baseCommit}}' onto '{{.targetBranchName}}'", DroppingStash: "Dropping stash %s", PoppingStash: "Popping stash %s", + DeletingBranch: "Deleting branch '{{.branchName}}' (was {{.hash}})", }, BreakingChangesTitle: "Breaking Changes", BreakingChangesMessage: `You are updating to a new version of lazygit which contains breaking changes. Please review the notes below and update your configuration if necessary.