Set<GitLocalBranch> (@NotNull GitRepository gitRepository) { Set<GitLocalBranch> branchesWithOutgoing = new HashSet<>(); GitBranchesCollection branchesCollection = gitRepository.getBranches(); for (GitLocalBranch branch : branchesCollection.getLocalBranches()) { GitPushTarget pushTarget = GitPushSupport.getPushTargetIfExist(gitRepository, branch); Hash localHashForRemoteBranch = pushTarget != null ? branchesCollection.getHash(pushTarget.getBranch()) : null; Hash localHash = branchesCollection.getHash(branch); if (hasCommitsForBranch(gitRepository, branch, localHash, localHashForRemoteBranch, false)) { branchesWithOutgoing.add(branch); } } return branchesWithOutgoing; }