Package org.eclipse.jgit.api
Class RenameBranchCommand
Used to rename branches.
- See Also:
-
Field Summary
FieldsFields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructor for RenameBranchCommand. -
Method Summary
Modifier and TypeMethodDescriptioncall()
setNewName
(String newName) Sets the new short name of the branch.setOldName
(String oldName) Sets the old name of the branch.Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
oldName
-
newName
-
-
Constructor Details
-
RenameBranchCommand
Constructor for RenameBranchCommand.
- Parameters:
repo
- theRepository
-
-
Method Details
-
call
public Ref call() throws GitAPIException, RefNotFoundException, InvalidRefNameException, RefAlreadyExistsException, DetachedHeadExceptionExecute the command
- Specified by:
call
in interfaceCallable<Ref>
- Specified by:
call
in classGitCommand<Ref>
- Throws:
GitAPIException
RefNotFoundException
InvalidRefNameException
RefAlreadyExistsException
DetachedHeadException
-
setNewName
Sets the new short name of the branch.The full name is constructed using the prefix of the branch to be renamed defined by either
setOldName(String)
or HEAD. If that old branch is a local branch, the renamed branch also will be, and if the old branch is a remote branch, so will be the renamed branch.- Parameters:
newName
- the new name- Returns:
- this instance
-
setOldName
Sets the old name of the branch.oldName
may be a short or a full name. Using a full name is recommended to unambiguously identify the branch to be renamed.- 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
-