Top Description Fields Constructors Methods
org.eclipse.jgit.api

public Class RenameBranchCommand

extends GitCommand<Ref>
Class Inheritance
Imports
java.io.IOException, java.text.MessageFormat, java.util.Arrays, org.eclipse.jgit.api.errors.DetachedHeadException, .GitAPIException, .InvalidRefNameException, .JGitInternalException, .NoHeadException, .RefAlreadyExistsException, .RefNotFoundException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.ConfigConstants, .Constants, .ObjectId, .Ref, .RefRename, .RefUpdate.Result, .Repository, .StoredConfig

Used to rename branches.
See Also
Git documentation about Branch

Field Summary

Modifier and TypeField and Description
private String
private String
Inherited from org.eclipse.jgit.api.GitCommand:
repo

Constructor Summary

AccessConstructor and Description
protected
RenameBranchCommand(Repository repo)

Constructor for RenameBranchCommand.

Method Summary

Modifier and TypeMethod and Description
public Ref
call()

Implements abstract org.eclipse.jgit.api.GitCommand.call.

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

public RenameBranchCommand

Returns:

this instance
setNewName
(String
the new name
newName
)

Sets the new short name of the branch.

public RenameBranchCommand

Returns:

this instance
setOldName
(String
the name of the branch to rename; if not set, the currently checked out branch (if any) will be renamed
oldName
)

Sets the old name of the branch.

Inherited from org.eclipse.jgit.api.GitCommand:
checkCallablegetRepositorysetCallable

Field Detail

newNameback to summary
private String newName
oldNameback to summary
private String oldName

Constructor Detail

RenameBranchCommandback to summary
protected RenameBranchCommand(Repository repo)

Constructor for RenameBranchCommand.

Parameters
repo:Repository

the org.eclipse.jgit.lib.Repository

Method Detail

callback to summary
public Ref call() throws GitAPIException, RefNotFoundException, InvalidRefNameException, RefAlreadyExistsException, DetachedHeadException

Implements abstract org.eclipse.jgit.api.GitCommand.call.

Implements java.util.concurrent.Callable.call.

Doc from org.eclipse.jgit.api.GitCommand.call.

Computes a result, or throws an exception if unable to do so.

Execute the command

Returns:Ref

Doc from java.util.concurrent.Callable.call.

computed result

Annotations
@Override
setNewNameback to summary
public RenameBranchCommand setNewName(String newName)

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:String

the new name

Returns:RenameBranchCommand

this instance

setOldNameback to summary
public RenameBranchCommand setOldName(String oldName)

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:String

the name of the branch to rename; if not set, the currently checked out branch (if any) will be renamed

Returns:RenameBranchCommand

this instance