diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 5df604da8..1fdccd986 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -1219,12 +1219,17 @@ public void RefreshBranches() public void RefreshWorktrees() { var worktrees = new Commands.Worktree(_fullpath).ReadAllAsync().Result; + string commonDir = null; + if (worktrees.Count > 0) + commonDir = new Commands.QueryGitCommonDir(_fullpath).GetResultAsync().Result; var cleaned = new List(); foreach (var worktree in worktrees) { if (worktree.IsBare || worktree.FullPath.Equals(_fullpath)) continue; + if (!string.IsNullOrEmpty(commonDir) && worktree.FullPath.Equals(commonDir)) + continue; cleaned.Add(worktree); }