GitCommandResult (@NotNull GitRepository repository, @NotNull String upstreamBranchName, @NotNull String branchName) { GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.BRANCH); h.setStdoutSuppressed(false); if (GitVersionSpecialty.KNOWS_SET_UPSTREAM_TO.existsIn(repository)) { h.addParameters("--set-upstream-to", upstreamBranchName, branchName); } else { h.addParameters("--set-upstream", branchName, upstreamBranchName); } return runCommand(h); }