private static boolean createEmptyGitRepository(
     @NotNull Project project, @NotNull VirtualFile root, @NotNull ProgressIndicator indicator) {
   final GitLineHandler h = new GitLineHandler(project, root, GitCommand.INIT);
   GitHandlerUtil.runInCurrentThread(
       h, indicator, true, GitBundle.getString("initializing.title"));
   if (!h.errors().isEmpty()) {
     GitUIUtil.showOperationErrors(project, h.errors(), "git init");
     LOG.info("Failed to create empty git repo: " + h.errors());
     return false;
   }
   GitInit.refreshAndConfigureVcsMappings(project, root, root.getPath());
   return true;
 }
  private static void doRebaseCurrentBranch(
      @NotNull final Project project,
      @NotNull final VirtualFile root,
      @NotNull final ProgressIndicator indicator) {
    final GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);

    final GitRebaser rebaser =
        new GitRebaser(project, ServiceManager.getService(Git.class), indicator);

    final GitLineHandler handler = new GitLineHandler(project, root, GitCommand.REBASE);
    handler.addParameters("upstream/master");

    final GitRebaseProblemDetector rebaseConflictDetector = new GitRebaseProblemDetector();
    handler.addLineListener(rebaseConflictDetector);

    final GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector =
        new GitUntrackedFilesOverwrittenByOperationDetector(root);
    handler.addLineListener(untrackedFilesDetector);

    GitTask pullTask = new GitTask(project, handler, "Rebasing from upstream/master");
    pullTask.setProgressIndicator(indicator);
    pullTask.setProgressAnalyzer(new GitStandardProgressAnalyzer());
    pullTask.execute(
        true,
        false,
        new GitTaskResultHandlerAdapter() {
          @Override
          protected void onSuccess() {
            root.refresh(false, true);
            repositoryManager.updateRepository(root);
            GithubNotifications.showInfo(project, "Success", "Successfully rebased GitHub fork");
          }

          @Override
          protected void onFailure() {
            GitUpdateResult result =
                rebaser.handleRebaseFailure(
                    handler, root, rebaseConflictDetector, untrackedFilesDetector);
            repositoryManager.updateRepository(root);
            if (result == GitUpdateResult.NOTHING_TO_UPDATE
                || result == GitUpdateResult.SUCCESS
                || result == GitUpdateResult.SUCCESS_WITH_RESOLVED_CONFLICTS) {
              GithubNotifications.showInfo(project, "Success", "Successfully rebased GitHub fork");
            }
          }
        });
  }