Package org.eclipse.jgit.api
Class DeleteBranchCommand
Used to delete one or several branches.
The result of
call() is a list with the (full) names of the deleted
branches.
Note that we don't have a setter corresponding to the -r option; remote
tracking branches are simply deleted just like local branches.- See Also:
-
Field Summary
FieldsFields inherited from class org.eclipse.jgit.api.GitCommand
repo -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor for DeleteBranchCommand -
Method Summary
Modifier and TypeMethodDescriptioncall()setBranchNames(String... branchnames) Set the names of the branches to deletesetForce(boolean force) Set whether to forcefully delete branchesMethods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
branchNames
-
force
private boolean force
-
-
Constructor Details
-
DeleteBranchCommand
Constructor for DeleteBranchCommand- Parameters:
repo- theRepository
-
-
Method Details
-
call
public List<String> call() throws GitAPIException, NotMergedException, CannotDeleteCurrentBranchExceptionExecute the command
- Specified by:
callin interfaceCallable<List<String>>- Specified by:
callin classGitCommand<List<String>>- Throws:
GitAPIExceptionNotMergedExceptionCannotDeleteCurrentBranchException
-
setBranchNames
Set the names of the branches to delete- Parameters:
branchnames- the names of the branches to delete; if not set, this will do nothing; invalid branch names will simply be ignored- Returns:
- this instance
-
setForce
Set whether to forcefully delete branches- Parameters:
force-truecorresponds to the -D option,falseto the -d option (default)
iffalsea check will be performed whether the branch to be deleted is already merged into the current branch and deletion will be refused in this case- Returns:
- this instance
-