diff --git a/pkg/gui/controllers/helpers/branches_helper.go b/pkg/gui/controllers/helpers/branches_helper.go index 8760c4366..5566dc40c 100644 --- a/pkg/gui/controllers/helpers/branches_helper.go +++ b/pkg/gui/controllers/helpers/branches_helper.go @@ -283,7 +283,9 @@ func (self *BranchesHelper) AutoForwardBranches() error { updateCommands := "" // The first branch is the currently checked out branch; skip it for _, branch := range branches[1:] { - if branch.RemoteBranchStoredLocally() && (allBranches || lo.Contains(self.c.UserConfig().Git.MainBranches, branch.Name)) { + if branch.RemoteBranchStoredLocally() && + !self.checkedOutByOtherWorktree(branch) && + (allBranches || lo.Contains(self.c.UserConfig().Git.MainBranches, branch.Name)) { isStrictlyBehind := branch.IsBehindForPull() && !branch.IsAheadForPull() if isStrictlyBehind { updateCommands += fmt.Sprintf("update %s %s %s\n", branch.FullRefName(), branch.FullUpstreamRefName(), branch.CommitHash) diff --git a/pkg/integration/tests/sync/fetch_and_auto_forward_branches_all_branches_checked_out_in_other_worktree.go b/pkg/integration/tests/sync/fetch_and_auto_forward_branches_all_branches_checked_out_in_other_worktree.go index e0913fb0e..bc1ecd294 100644 --- a/pkg/integration/tests/sync/fetch_and_auto_forward_branches_all_branches_checked_out_in_other_worktree.go +++ b/pkg/integration/tests/sync/fetch_and_auto_forward_branches_all_branches_checked_out_in_other_worktree.go @@ -51,10 +51,7 @@ var FetchAndAutoForwardBranchesAllBranchesCheckedOutInOtherWorktree = NewIntegra Contains("checked-out").IsSelected(), Contains("diverged ↓2↑1"), Contains("feature ✓"), - /* EXPECTED: Contains("master (worktree) ↓1"), - ACTUAL: */ - Contains("master (worktree) ✓"), ) }, })