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
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructor for DeleteBranchCommand -
Method Summary
Modifier and TypeMethodDescriptioncall()
Retrieves the progress monitor.setBranchNames
(String... branchnames) Set the names of the branches to deletesetBranchNames
(Collection<String> branchNames) Sets the names of the branches to deletesetForce
(boolean force) Set whether to forcefully delete branchessetProgressMonitor
(ProgressMonitor monitor) Sets the progress monitor associated with the delete operation.Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Constructor Details
-
DeleteBranchCommand
Constructor for DeleteBranchCommand- Parameters:
repo
- theRepository
-
-
Method Details
-
call
public List<String> call() throws GitAPIException, NotMergedException, CannotDeleteCurrentBranchExceptionDescription copied from class:GitCommand
Execute the command
- Specified by:
call
in interfaceCallable<List<String>>
- Specified by:
call
in classGitCommand<List<String>>
- Throws:
GitAPIException
NotMergedException
CannotDeleteCurrentBranchException
-
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
-
setBranchNames
Sets 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
- Since:
- 6.8
-
setForce
Set whether to forcefully delete branches- Parameters:
force
-true
corresponds to the -D option,false
to the -d option (default)
iffalse
a 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
-
getProgressMonitor
Retrieves the progress monitor.- Returns:
- the
ProgressMonitor
for the delete operation - Since:
- 6.8
-
setProgressMonitor
Sets the progress monitor associated with the delete operation. By default, this is set toNullProgressMonitor
- Parameters:
monitor
- aProgressMonitor
- Returns:
this
- Since:
- 6.8
- See Also:
-