Package org.eclipse.jgit.api
Class RenameBranchCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<Ref>
-
- org.eclipse.jgit.api.RenameBranchCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<Ref>
public class RenameBranchCommand extends GitCommand<Ref>
Used to rename branches.- See Also:
- Git documentation about Branch
-
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RenameBranchCommand(Repository repo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Ref
call()
Executes the commandRenameBranchCommand
setNewName(java.lang.String newName)
RenameBranchCommand
setOldName(java.lang.String oldName)
-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
RenameBranchCommand
protected RenameBranchCommand(Repository repo)
- Parameters:
repo
-
-
-
Method Detail
-
call
public Ref call() throws GitAPIException, RefNotFoundException, InvalidRefNameException, RefAlreadyExistsException, DetachedHeadException
Description copied from class:GitCommand
Executes the command- Specified by:
call
in interfacejava.util.concurrent.Callable<Ref>
- Specified by:
call
in classGitCommand<Ref>
- Returns:
- T a result. Each command has its own return type
- Throws:
RefNotFoundException
- if the old branch can not be found (branch with provided old name does not exist or old name resolves to a tag)InvalidRefNameException
- if the provided new name isnull
or otherwise invalidRefAlreadyExistsException
- if a branch with the new name already existsDetachedHeadException
- if rename is tried without specifying the old name and HEAD is detachedGitAPIException
- or subclass thereof when an error occurs
-
setNewName
public RenameBranchCommand setNewName(java.lang.String newName)
- Parameters:
newName
- the new name- Returns:
- this instance
-
setOldName
public RenameBranchCommand setOldName(java.lang.String oldName)
- Parameters:
oldName
- the name of the branch to rename; if not set, the currently checked out branch (if any) will be renamed- Returns:
- this instance
-
-