Class GitRebaseCommandParameters
java.lang.Object
com.atlassian.bitbucket.util.BuilderSupport
com.atlassian.bitbucket.scm.AbstractCommandParameters
com.atlassian.bitbucket.scm.git.command.GitRebaseCommandParameters
public class GitRebaseCommandParameters
extends com.atlassian.bitbucket.scm.AbstractCommandParameters
Parameters to perform a
git rebase operation for a given branch, to recreate its
unique commits based on a given upstream.- Since:
- 5.5
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class com.atlassian.bitbucket.util.BuilderSupport
NOT_BLANK -
Method Summary
Modifier and TypeMethodDescriptioncom.atlassian.bitbucket.repository.BranchRetrieves the branch which should be rebased.com.atlassian.bitbucket.user.ApplicationUserRetrieves the commit to compare thebranchagainst and to serve as the starting point for the rebased commits.Optional<com.atlassian.bitbucket.repository.Repository>booleanRetrieves a flag indicating whether a rebase is required to produce at least one commit, or whether it is allowed to reset thebranchto theupstream commitas-is.booleanisDryRun()Methods inherited from class com.atlassian.bitbucket.util.BuilderSupport
addIf, addIf, addIf, addIf, addIf, addIf, checkNotBlank, requireNonBlank
-
Method Details
-
getBranch
@Nonnull public com.atlassian.bitbucket.repository.Branch getBranch()Retrieves the branch which should be rebased. Commits unique to this branch, compared toupstream, will be recreated as descendants of theupstreamcommit.git rebaseallows starting from a specific commit (detachedHEAD, not just branches, but performing a rebase via this API intentionally does not. The rebase is performed in a temporary work tree, sincegit rebasecannot be run in bare repositories, and a specific branch to update is required in order to fetch the rebased commits back into the bare repository.- Returns:
- the branch to rebase
-
getCommitter
@Nonnull public com.atlassian.bitbucket.user.ApplicationUser getCommitter()- Returns:
- the user performing the rebase
-
getUpstream
Retrieves the commit to compare thebranchagainst and to serve as the starting point for the rebased commits. This value must be specified as a full 40-character SHA-1. using a ref name is not supported.- Returns:
- the upstream commit to rebase the
branch's unique commits against
-
getUpstreamRepository
-
isCommitRequired
public boolean isCommitRequired()Retrieves a flag indicating whether a rebase is required to produce at least one commit, or whether it is allowed to reset thebranchto theupstream commitas-is.Regardless of the number of unique commits on the
branch, if all of their individual changes have already been applied in a compatible way on theupstream(such that no conflicts arise), the rebase may discard all of the branch's commits. In some cases that may be desirable, and in some it may not.- Returns:
trueif the rebase should fail if all of thebranch'scommits are discarded; otherwise,falseto allow the branch to be reset to theupstream commit
-
isDryRun
public boolean isDryRun()- Returns:
trueto perform the rebase without updating thebranch; otherwise,falseto apply the rebase and update the branch
-