javagit/src/main/java/edu/nyu/cs/javagit/api/DotGit.java
public Ref renameBranch(Ref branchFrom, String nameTo, boolean forceRename) 
    throws IOException, JavaGitException {
    Ref newBranch = Ref.createBranchRef(nameTo);
    GitBranch gitBranch = new GitBranch();
    gitBranch.renameBranch(path, forceRename, branchFrom, newBranch);
    return newBranch;
  }
public Ref renameBranch(Ref branchFrom, String nameTo, boolean forceRename) 
    throws IOException, JavaGitException {
    Ref newBranch = Ref.createBranchRef(nameTo);
    GitBranch gitBranch = new GitBranch();
    gitBranch.renameBranch(path, forceRename, branchFrom, newBranch);
    return newBranch;
  }
public Ref renameBranch ( Ref branchFrom , String nameTo , boolean forceRename ) throws IOException , JavaGitException { Ref newBranch = Ref . createBranchRef ( nameTo ) ; GitBranch gitBranch = new GitBranch ( ) ; gitBranch . renameBranch ( path , forceRename , branchFrom , newBranch ) ; return newBranch ; }
Renames a branch

@param branchFrom
The branch to rename
@param nameTo
New branch name
@param forceRename
True if force rename option -M should be used.
False if -m should be used.
@return new <code>Ref</code> instance
@throws IOException
Thrown in case of I/O operation failure
@throws JavaGitException
Thrown when there is an error executing git-branch.
Renames a branch