Package org.eclipse.jgit.api
Class RenameBranchCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<Ref>
-
- org.eclipse.jgit.api.RenameBranchCommand
-
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 protectedRenameBranchCommand(Repository repo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Refcall()Executes the commandRenameBranchCommandsetNewName(String newName)RenameBranchCommandsetOldName(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:GitCommandExecutes the command- Specified by:
callin interfaceCallable<Ref>- Specified by:
callin 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 isnullor 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(String newName)
- Parameters:
newName- the new name- Returns:
- this instance
-
setOldName
public RenameBranchCommand setOldName(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
-
-