diff --git a/src/GitTabExpansion.ps1 b/src/GitTabExpansion.ps1 index a9a2a7c12..d0dbef811 100644 --- a/src/GitTabExpansion.ps1 +++ b/src/GitTabExpansion.ps1 @@ -359,9 +359,11 @@ function GitTabExpansionInternal($lastBlock, $GitStatus = $null) { # Handles git checkout "^(?:checkout).* (?\S*)$" { - gitBranches $matches['ref'] $true - gitRemoteUniqueBranches $matches['ref'] - gitTags $matches['ref'] + $script:gitBranches = @(gitBranches $matches['ref'] $true) + $script:gitRemoteUniqueBranches = @(gitRemoteUniqueBranches $matches['ref']) + $script:gitTags = @(gitTags $matches['ref']) + # return only unique branches (to eliminate duplicates where the branch exists locally and on the remote) + $script:gitBranches + $script:gitRemoteUniqueBranches + $script:gitTags | Sort-Object -Unique } # Handles git worktree add