public class RebaseCommand extends GitCommand<RebaseResult>
Rebase command. It has setters for all
supported options and arguments of this command and a call() method
to finally execute the command. Each instance of this class should only be
used for one invocation of the command (means: one call to call())
| Modifier and Type | Class and Description |
|---|---|
static interface |
RebaseCommand.InteractiveHandler
Allows configure rebase interactive process and modify commit message
|
static class |
RebaseCommand.Operation
The available operations
|
| Modifier and Type | Field and Description |
|---|---|
static String |
REBASE_MERGE
The name of the "rebase-merge" folder for interactive rebases.
|
static String |
STOPPED_SHA
The name of the "stopped-sha" file
|
repo| Modifier | Constructor and Description |
|---|---|
protected |
RebaseCommand(Repository repo)
Constructor for RebaseCommand.
|
| Modifier and Type | Method and Description |
|---|---|
RebaseResult |
call() |
RebaseCommand |
runInteractively(RebaseCommand.InteractiveHandler handler)
Enable interactive rebase
|
RebaseCommand |
runInteractively(RebaseCommand.InteractiveHandler handler,
boolean stopAfterRebaseInteractiveInitialization)
Enable interactive rebase
|
RebaseCommand |
setOperation(RebaseCommand.Operation operation)
Set the operation to execute during rebase
|
RebaseCommand |
setPreserveMerges(boolean preserve)
Whether to preserve merges during rebase
|
RebaseCommand |
setProgressMonitor(ProgressMonitor monitor)
Set progress monitor
|
RebaseCommand |
setStrategy(MergeStrategy strategy)
Set the
MergeStrategy. |
RebaseCommand |
setUpstream(AnyObjectId upstream)
Set the upstream commit
|
RebaseCommand |
setUpstream(RevCommit upstream)
Set upstream
RevCommit |
RebaseCommand |
setUpstream(String upstream)
Set the upstream branch
|
RebaseCommand |
setUpstreamName(String upstreamName)
Optionally override the name of the upstream.
|
RevCommit |
tryFastForward(RevCommit newCommit)
Check if we can fast-forward and returns the new head if it is possible
|
checkCallable, getRepository, setCallablepublic static final String REBASE_MERGE
public static final String STOPPED_SHA
protected RebaseCommand(Repository repo)
Constructor for RebaseCommand.
repo - the Repositorypublic RebaseResult call() throws GitAPIException, NoHeadException, RefNotFoundException, WrongRepositoryStateException
Execute the command
Executes the Rebase command with all the options and parameters
collected by the setter methods of this class. Each instance of this
class should only be used for one invocation of the command. Don't call
this method twice on an instance.
call in interface Callable<RebaseResult>call in class GitCommand<RebaseResult>GitAPIExceptionNoHeadExceptionRefNotFoundExceptionWrongRepositoryStateExceptionpublic RevCommit tryFastForward(RevCommit newCommit) throws IOException, GitAPIException
newCommit - a RevCommit object to check
if we can fast-forward to.IOExceptionGitAPIExceptionpublic RebaseCommand setUpstream(RevCommit upstream)
RevCommitupstream - the upstream committhispublic RebaseCommand setUpstream(AnyObjectId upstream)
upstream - id of the upstream committhispublic RebaseCommand setUpstream(String upstream) throws RefNotFoundException
upstream - the name of the upstream branchthisRefNotFoundExceptionpublic RebaseCommand setUpstreamName(String upstreamName)
setUpstream(org.eclipse.jgit.revwalk.RevCommit) call.upstreamName - the name which will be used to refer to upstream in conflictsthispublic RebaseCommand setOperation(RebaseCommand.Operation operation)
operation - the operation to performthispublic RebaseCommand setProgressMonitor(ProgressMonitor monitor)
monitor - a progress monitorpublic RebaseCommand runInteractively(RebaseCommand.InteractiveHandler handler)
Does not stop after initialization of interactive rebase. This is
equivalent to
runInteractively(handler, false);
handler - the
RebaseCommand.InteractiveHandler
to usepublic RebaseCommand runInteractively(RebaseCommand.InteractiveHandler handler, boolean stopAfterRebaseInteractiveInitialization)
If stopAfterRebaseInteractiveInitialization is true the rebase
stops after initialization of interactive rebase returning
RebaseResult.INTERACTIVE_PREPARED_RESULT
handler - the
RebaseCommand.InteractiveHandler
to usestopAfterRebaseInteractiveInitialization - if true the rebase stops after initializationpublic RebaseCommand setStrategy(MergeStrategy strategy)
MergeStrategy.strategy - The merge strategy to use during this rebase operation.thispublic RebaseCommand setPreserveMerges(boolean preserve)
preserve - true to re-create merges during rebase. Defaults to
false, a flattening rebase.thisCopyright © 2018 Eclipse JGit Project. All rights reserved.