From 1e014d00018b3fee30dff1691fb4e65df05771b7 Mon Sep 17 00:00:00 2001 From: Gadfly Date: Fri, 15 May 2026 00:36:25 +0800 Subject: [PATCH] fix: remove duplicate branch when overwriting existing branch When using OverwriteExisting to reset a local branch to upstream, the branch list showed two duplicate entries because the old branch object was not removed before adding the new one. --- src/ViewModels/Repository.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index c85f12d50..c0f8c432e 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -777,6 +777,7 @@ public void RefreshAfterCreateBranch(Models.Branch created, bool checkout) _watcher?.MarkBranchUpdated(); _watcher?.MarkWorkingCopyUpdated(); + _branches.RemoveAll(b => b.IsLocal && b.FriendlyName.Equals(created.FriendlyName, StringComparison.Ordinal)); _branches.Add(created); if (checkout)