Top Description Inners Fields Constructors Methods
org.eclipse.jgit.lib

public Class BranchConfig

extends Object
Class Inheritance
Imports
java.net.URISyntaxException, org.eclipse.jgit.transport.RefSpec, .RemoteConfig

Branch section of a Git configuration file.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
BranchConfig.BranchRebaseMode

Config values for branch.[name].rebase (and pull.rebase).

Field Summary

Modifier and TypeField and Description
private final String
private final Config
public static final String
LOCAL_REPOSITORY

The value that means "local repository" for getRemote():

Constructor Summary

AccessConstructor and Description
public
BranchConfig(Config
the config to read from
config
,
String
the short branch name of the section to read
branchName
)

Create a new branch config, which will read configuration from config about specified branch.

Method Summary

Modifier and TypeMethod and Description
private String

Returns:

full remote tracking branch name or null
findRemoteTrackingBranch
(String
Remote name
remote
,
String
merge Ref of the local branch tracking the remote tracking branch
mergeRef
)

Finds the tracked remote tracking branch

public String

Returns:

the name of the upstream branch as it is called on the remote, or null if not defined
getMerge
()

Get the name of the upstream branch as it is called on the remote

public String

Returns:

the remote this branch is configured to push to, or null if not defined
getPushRemote
()

Get the remote this branch is configured to push to.

public BranchConfig.BranchRebaseMode
getRebaseMode()

Retrieves the config value of branch.[name].rebase.

public String

Returns:

the remote this branch is configured to fetch from/push to, or null if not defined
getRemote
()

Get the remote this branch is configured to fetch from/push to

private String
public String

Returns:

the full remote-tracking branch name or null if it could not be determined. If you also want local tracked branches use getTrackingBranch() instead.
getRemoteTrackingBranch
()

Get the full remote-tracking branch name

public String

Returns:

the full tracking branch name or null if it could not be determined
getTrackingBranch
()

Get the full tracking branch name

public boolean

Returns:

true if the branch is configured to be rebased
isRebase
()

Whether the branch is configured to be rebased

public boolean

Returns:

true if the "remote" setting points to the local repository (with .), false otherwise
isRemoteLocal
()

Whether the "remote" setting points to the local repository (with .)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

branchNameback to summary
private final String branchName
configback to summary
private final Config config
LOCAL_REPOSITORYback to summary
public static final String LOCAL_REPOSITORY

The value that means "local repository" for getRemote():

Since
3.5

Constructor Detail

BranchConfigback to summary
public BranchConfig(Config config, String branchName)

Create a new branch config, which will read configuration from config about specified branch.

Parameters
config:Config

the config to read from

branchName:String

the short branch name of the section to read

Method Detail

findRemoteTrackingBranchback to summary
private String findRemoteTrackingBranch(String remote, String mergeRef)

Finds the tracked remote tracking branch

Parameters
remote:String

Remote name

mergeRef:String

merge Ref of the local branch tracking the remote tracking branch

Returns:String

full remote tracking branch name or null

getMergeback to summary
public String getMerge()

Get the name of the upstream branch as it is called on the remote

Returns:String

the name of the upstream branch as it is called on the remote, or null if not defined

Since
3.5
getPushRemoteback to summary
public String getPushRemote()

Get the remote this branch is configured to push to.

Returns:String

the remote this branch is configured to push to, or null if not defined

Since
6.1
getRebaseModeback to summary
public BranchConfig.BranchRebaseMode getRebaseMode()

Retrieves the config value of branch.[name].rebase.

Returns:BranchConfig.BranchRebaseMode

the org.eclipse.jgit.lib.BranchConfig.BranchRebaseMode

Since
4.5
getRemoteback to summary
public String getRemote()

Get the remote this branch is configured to fetch from/push to

Returns:String

the remote this branch is configured to fetch from/push to, or null if not defined

Since
3.5
getRemoteOrDefaultback to summary
private String getRemoteOrDefault()
getRemoteTrackingBranchback to summary
public String getRemoteTrackingBranch()

Get the full remote-tracking branch name

Returns:String

the full remote-tracking branch name or null if it could not be determined. If you also want local tracked branches use getTrackingBranch() instead.

getTrackingBranchback to summary
public String getTrackingBranch()

Get the full tracking branch name

Returns:String

the full tracking branch name or null if it could not be determined

isRebaseback to summary
public boolean isRebase()

Whether the branch is configured to be rebased

Returns:boolean

true if the branch is configured to be rebased

Since
3.5
isRemoteLocalback to summary
public boolean isRemoteLocal()

Whether the "remote" setting points to the local repository (with .)

Returns:boolean

true if the "remote" setting points to the local repository (with .), false otherwise

Since
3.5
org.eclipse.jgit.lib back to summary

public sealed Enum BranchConfig.BranchRebaseMode

extends Enum<BranchConfig.BranchRebaseMode>
implements ConfigEnum
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.lib.Config.ConfigEnum

Config values for branch.[name].rebase (and pull.rebase).
Since
4.5

Field Summary

Modifier and TypeField and Description
private final String
public static final BranchConfig.BranchRebaseMode
INTERACTIVE

Value for rebasing interactively

public static final BranchConfig.BranchRebaseMode
MERGES

Value for rebasing preserving local merge commits

public static final BranchConfig.BranchRebaseMode
NONE

Value for not rebasing at all but merging

public static final BranchConfig.BranchRebaseMode
REBASE

Value for rebasing

Constructor Summary

AccessConstructor and Description
private
BranchRebaseMode(String configValue)

Method Summary

Modifier and TypeMethod and Description
public boolean
matchConfigValue(String
the string to match
s
)

Implements org.eclipse.jgit.lib.Config.ConfigEnum.matchConfigValue.

Checks if the given string matches with enum value.

public String
toConfigValue()

Implements org.eclipse.jgit.lib.Config.ConfigEnum.toConfigValue.

Converts enumeration value into a string to be save in config.

public static BranchConfig.BranchRebaseMode
public static BranchConfig.BranchRebaseMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

configValueback to summary
private final String configValue
INTERACTIVEback to summary
public static final BranchConfig.BranchRebaseMode INTERACTIVE

Value for rebasing interactively

MERGESback to summary
public static final BranchConfig.BranchRebaseMode MERGES

Value for rebasing preserving local merge commits

Since
6.5 used instead of deprecated "preserve" option
NONEback to summary
public static final BranchConfig.BranchRebaseMode NONE

Value for not rebasing at all but merging

REBASEback to summary
public static final BranchConfig.BranchRebaseMode REBASE

Value for rebasing

Constructor Detail

BranchRebaseModeback to summary
private BranchRebaseMode(String configValue)

Method Detail

matchConfigValueback to summary
public boolean matchConfigValue(String s)

Implements org.eclipse.jgit.lib.Config.ConfigEnum.matchConfigValue.

Doc from org.eclipse.jgit.lib.Config.ConfigEnum.matchConfigValue.

Checks if the given string matches with enum value.

Parameters
s:String

the string to match

Returns:boolean

true if the given string matches enum value, false otherwise

Annotations
@Override
toConfigValueback to summary
public String toConfigValue()

Implements org.eclipse.jgit.lib.Config.ConfigEnum.toConfigValue.

Doc from org.eclipse.jgit.lib.Config.ConfigEnum.toConfigValue.

Converts enumeration value into a string to be save in config.

Returns:String

the enum value as config string

Annotations
@Override
valueOfback to summary
public static BranchConfig.BranchRebaseMode valueOf(String name)
valuesback to summary
public static BranchConfig.BranchRebaseMode[] values()