List<String> (@NotNull GitRepository repository) { List<GitBranch> localBranches = new ArrayList<>(repository.getBranches().getLocalBranches()); Collections.sort(localBranches); List<GitBranch> remoteBranches = new ArrayList<>(repository.getBranches().getRemoteBranches()); Collections.sort(remoteBranches); if (repository.isOnBranch()) { localBranches.remove(repository.getCurrentBranch()); } List<String> branchNames = new ArrayList<>(); for (GitBranch branch : localBranches) { branchNames.add(branch.getName()); } for (GitBranch branch : remoteBranches) { branchNames.add(branch.getName()); } return branchNames; }