public class RenameBranchCommand extends GitCommand<Ref>
repo
Modifier | Constructor and Description |
---|---|
protected |
RenameBranchCommand(Repository repo)
Constructor for RenameBranchCommand.
|
Modifier and Type | Method and Description |
---|---|
Ref |
call() |
RenameBranchCommand |
setNewName(String newName)
Sets the new short name of the branch.
|
RenameBranchCommand |
setOldName(String oldName)
Sets the old name of the branch.
|
checkCallable, getRepository, setCallable
protected RenameBranchCommand(Repository repo)
Constructor for RenameBranchCommand.
repo
- the Repository
public Ref call() throws GitAPIException, RefNotFoundException, InvalidRefNameException, RefAlreadyExistsException, DetachedHeadException
Execute the command
call
in interface Callable<Ref>
call
in class GitCommand<Ref>
GitAPIException
RefNotFoundException
InvalidRefNameException
RefAlreadyExistsException
DetachedHeadException
public RenameBranchCommand setNewName(String newName)
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.
newName
- the new namepublic RenameBranchCommand setOldName(String oldName)
oldName
may be a short or a full name. Using a full name is
recommended to unambiguously identify the branch to be renamed.
oldName
- the name of the branch to rename; if not set, the currently
checked out branch (if any) will be renamedCopyright © 2019 Eclipse JGit Project. All rights reserved.