void () { boolean fatalErrorHappened = false; notifyBranchWillChange(); while (hasMoreRepositories() && !fatalErrorHappened) { final GitRepository repository = next(); GitSimpleEventDetector unmergedDetector = new GitSimpleEventDetector(GitSimpleEventDetector.Event.UNMERGED_PREVENTING_CHECKOUT); GitCommandResult result = myGit.checkoutNewBranch(repository, myNewBranchName, unmergedDetector); if (result.success()) { refresh(repository); markSuccessful(repository); } else if (unmergedDetector.hasHappened()) { fatalUnmergedFilesError(); fatalErrorHappened = true; } else { fatalError(GitBundle.message("checkout.new.branch.operation.could.not.create.new.branch", myNewBranchName), result); fatalErrorHappened = true; } } if (!fatalErrorHappened) { notifySuccess(); notifyBranchHasChanged(myNewBranchName); updateRecentBranch(); } }