org.eclipse.jgit.api
Class DeleteBranchCommand
java.lang.Object
org.eclipse.jgit.api.GitCommand<List<String>>
org.eclipse.jgit.api.DeleteBranchCommand
- All Implemented Interfaces:
- Callable<List<String>>
public class DeleteBranchCommand
- extends GitCommand<List<String>>
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:
- Git documentation about Branch
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DeleteBranchCommand
protected DeleteBranchCommand(Repository repo)
- Parameters:
repo
-
call
public List<String> call()
throws JGitInternalException,
NotMergedException,
CannotDeleteCurrentBranchException
- Returns:
- the list with the (full) names of the deleted branches
- Throws:
NotMergedException
- when trying to delete a branch which has not been merged into
the currently checked out branch without force
JGitInternalException
CannotDeleteCurrentBranchException
setBranchNames
public DeleteBranchCommand setBranchNames(String... branchnames)
- 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
public DeleteBranchCommand setForce(boolean force)
- Parameters:
force
- true
corresponds to the -D option,
false
to the -d option (default)
if false
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
Copyright © 2011. All Rights Reserved.