private static @NotNull String getNearestRemoteMasterBranchCommit(@NotNull Project project) {
    String projectBasePath = project.getBasePath();
    if (projectBasePath == null) return "";
    String branchName = getCurrentBranchName(project);
    if (branchName.isEmpty()) return "";
    String remoteName = getRemoteName(project, branchName);
    Optional<String> optionalRemoteName = remoteName.lines().findFirst();
    if (optionalRemoteName.isEmpty()) return "";

    GeneralCommandLine commandLine = new GeneralCommandLine()
      .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE)
      .withWorkDirectory(projectBasePath)
      .withExePath("git")
      .withParameters("merge-base")
      .withParameters("HEAD")
      .withParameters(optionalRemoteName.get() + "/" + branchName);

    StringBuilder processOutput = new StringBuilder();
    try {
      OSProcessHandler handler = new OSProcessHandler(commandLine.withCharset(StandardCharsets.UTF_8));
      handler.addProcessListener(new CapturingProcessAdapter() {
        @Override
        public void processTerminated(@NotNull ProcessEvent event) {
          if (event.getExitCode() != 0) {
            LOG.warn("Couldn't get nearest commit from remote master: " + getOutput().getStderr());
          } else {
            processOutput.append(getOutput().getStdout());
          }
        }
      });
      handler.startNotify();
      handler.waitFor();
    }
    catch (ExecutionException e) {
      LOG.warn("Couldn't execute command for getting nearest commit from remote master", e);
    }
    return processOutput.toString().lines().findFirst().orElse("");
  }
private static @NotNull String getNearestRemoteMasterBranchCommit(@NotNull Project project)