diff --git a/pkg/commands/git_commands/branch_loader.go b/pkg/commands/git_commands/branch_loader.go index cb284f67f..7c91c1cbc 100644 --- a/pkg/commands/git_commands/branch_loader.go +++ b/pkg/commands/git_commands/branch_loader.go @@ -81,6 +81,12 @@ outer: } } + // Sort branches that don't have a recency value alphabetically + // (we're really doing this for the sake of deterministic behaviour across git versions) + slices.SortFunc(branches, func(a *models.Branch, b *models.Branch) bool { + return a.Name < b.Name + }) + branches = slices.Prepend(branches, branchesWithRecency...) foundHead := false