GitCommandResult (@NotNull GitLocalChangesWouldBeOverwrittenDetector detector, final @NotNull GitRepository repository, @NotNull @NlsSafe String target) { Collection<String> absolutePaths = toAbsolute(repository.getRoot(), detector.getRelativeFilePaths()); List<Change> affectedChanges = findLocalChangesForPaths(myProject, repository.getRoot(), absolutePaths, false); GitSmartOperationDialog.Choice choice = myUiHandler.showSmartOperationDialog(myProject, affectedChanges, absolutePaths, GitBundle.message(myPresentation.operationTitle), GitBundle.message(myPresentation.forceButtonTitle)); if (choice == GitSmartOperationDialog.Choice.SMART) { final Ref<GitCommandResult> result = Ref.create(); GitSaveChangesPolicy saveMethod = GitVcsSettings.getInstance(myProject).getSaveChangesPolicy(); new GitPreservingProcess(myProject, myGit, Collections.singleton(repository.getRoot()), GitBundle.message(myPresentation.operationTitle), target, saveMethod, myIndicator, () -> result.set(myGit.reset(repository, myMode, target))).execute(); return result.get(); } if (choice == GitSmartOperationDialog.Choice.FORCE) { return myGit.reset(repository, GitResetMode.HARD, target); } return null; }