public class CreateBranchCommand extends GitCommand<Ref>
Modifier and Type | Class and Description |
---|---|
static class |
CreateBranchCommand.SetupUpstreamMode
The modes available for setting up the upstream configuration
(corresponding to the --set-upstream, --track, --no-track options
|
repo
Modifier | Constructor and Description |
---|---|
protected |
CreateBranchCommand(Repository repo) |
Modifier and Type | Method and Description |
---|---|
Ref |
call()
Executes the command
|
CreateBranchCommand |
setForce(boolean force) |
CreateBranchCommand |
setName(String name) |
CreateBranchCommand |
setStartPoint(RevCommit startPoint) |
CreateBranchCommand |
setStartPoint(String startPoint) |
CreateBranchCommand |
setUpstreamMode(CreateBranchCommand.SetupUpstreamMode mode) |
checkCallable, getRepository, setCallable
protected CreateBranchCommand(Repository repo)
repo
- public Ref call() throws GitAPIException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException
GitCommand
call
in interface Callable<Ref>
call
in class GitCommand<Ref>
RefAlreadyExistsException
- when trying to create (without force) a branch with a name
that already existsRefNotFoundException
- if the start point can not be foundInvalidRefNameException
- if the provided name is null
or otherwise
invalidGitAPIException
- or subclass thereof when an error occurspublic CreateBranchCommand setName(String name)
name
- the name of the new branchpublic CreateBranchCommand setForce(boolean force)
force
- if true
and the branch with the given name
already exists, the start-point of an existing branch will be
set to a new start-point; if false, the existing branch will
not be changedpublic CreateBranchCommand setStartPoint(String startPoint)
startPoint
- corresponds to the start-point option; if null
,
the current HEAD will be usedpublic CreateBranchCommand setStartPoint(RevCommit startPoint)
startPoint
- corresponds to the start-point option; if null
,
the current HEAD will be usedpublic CreateBranchCommand setUpstreamMode(CreateBranchCommand.SetupUpstreamMode mode)
mode
- corresponds to the --track/--no-track/--set-upstream options;
may be null
Copyright © 2015 Eclipse JGit Project. All rights reserved.