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)
Constructor for CreateBranchCommand
|
Modifier and Type | Method and Description |
---|---|
Ref |
call() |
static boolean |
isValidBranchName(String branchName)
Check if the given branch name is valid
|
CreateBranchCommand |
setForce(boolean force)
Set whether to create the branch forcefully
|
CreateBranchCommand |
setName(String name)
Set the name of the new branch
|
CreateBranchCommand |
setStartPoint(RevCommit startPoint)
Set the start point
|
CreateBranchCommand |
setStartPoint(String startPoint)
Set the start point
|
CreateBranchCommand |
setUpstreamMode(CreateBranchCommand.SetupUpstreamMode mode)
Set the upstream mode
|
checkCallable, getRepository, setCallable
protected CreateBranchCommand(Repository repo)
repo
- the Repository
public Ref call() throws GitAPIException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException
Execute the command
call
in interface Callable<Ref>
call
in class GitCommand<Ref>
GitAPIException
RefAlreadyExistsException
RefNotFoundException
InvalidRefNameException
public static boolean isValidBranchName(String branchName)
branchName
- branch name to checktrue
if the branch name is validpublic 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 © 2019 Eclipse JGit Project. All rights reserved.