java.lang.Object
org.kohsuke.github.GHBranch
A branch in a repository.
- Author:
- Yusuke Kokubo
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Disables branch protection and allows anyone with push access to push changes.Enables branch protection to control what commit statuses are required to push.getName()
Gets name.getOwner()
Gets owner.Gets protection.Gets protection url.getSHA1()
Gets sha 1.boolean
Is protected boolean.Merge a ref into this branch.Merge a branch into this branch.toString()
To string.
-
Method Details
-
getOwner
Gets owner.- Returns:
- the repository that this branch is in.
-
getName
Gets name.- Returns:
- the name
-
isProtected
public boolean isProtected()Is protected boolean.- Returns:
- true if the push to this branch is restricted via branch protection.
-
getProtectionUrl
Gets protection url.- Returns:
- API URL that deals with the protection of this branch.
-
getProtection
Gets protection.- Returns:
- the protection
- Throws:
IOException
- the io exception
-
getSHA1
Gets sha 1.- Returns:
- The SHA1 of the commit that this branch currently points to.
-
disableProtection
Disables branch protection and allows anyone with push access to push changes.- Throws:
IOException
- if disabling protection fails
-
enableProtection
Enables branch protection to control what commit statuses are required to push.- Returns:
- GHBranchProtectionBuilder for enabling protection
- See Also:
-
merge
Merge a branch into this branch.- Parameters:
headBranch
- the branch whose head will be mergedcommitMessage
- the commit message- Returns:
- the merge
GHCommit
created, ornull
if the base already contains the head (nothing to merge). - Throws:
IOException
- if merging fails
-
merge
Merge a ref into this branch.- Parameters:
head
- the ref name that will be merged into this branch. Follows the usual ref naming rules, could be a branch name, tag, or commit sha.commitMessage
- the commit message- Returns:
- the merge
GHCommit
created, ornull
if the base already contains the head (nothing to merge). - Throws:
IOException
- if merging fails
-
toString
To string.
-