Package org.eclipse.jgit.api
Class ResetCommand
A class used to execute a
Reset
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()
)- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Collection<String>
private boolean
private ResetCommand.ResetType
private ProgressMonitor
private String
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRepository relative path of file or directory to resetcall()
private void
checkoutIndex
(ObjectId commitTree) disableRefLog
(boolean disable) Whether to disable reflogprivate String
boolean
Whether reflog is disabledprivate RevCommit
parseCommit
(ObjectId commitId) private void
private void
resetIndex
(ObjectId commitTree) private void
resetIndexForPaths
(ObjectId commitTree) private void
private void
private ObjectId
Set the reset modesetProgressMonitor
(ProgressMonitor monitor) The progress monitor associated with the reset operation.Set the name of theRef
to reset totoString()
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
ref
-
mode
-
filepaths
-
isReflogDisabled
private boolean isReflogDisabled -
monitor
-
-
Constructor Details
-
ResetCommand
Constructor for ResetCommand.
- Parameters:
repo
- theRepository
-
-
Method Details
-
call
Execute the command
Executes the
Reset
command. Each instance of this class should only be used for one invocation of the command. Don't call this method twice on an instance.- Specified by:
call
in interfaceCallable<Ref>
- Specified by:
call
in classGitCommand<Ref>
- Throws:
GitAPIException
CheckoutConflictException
-
parseCommit
-
resolveRefToCommitId
-
setRef
Set the name of theRef
to reset to- Parameters:
ref
- the ref to reset to, defaults to HEAD if not specified- Returns:
- this instance
-
setMode
Set the reset mode- Parameters:
mode
- the mode of the reset command- Returns:
- this instance
-
addPath
Repository relative path of file or directory to reset- Parameters:
path
- repository-relative path of file/directory to reset (with/
as separator)- Returns:
- this instance
-
disableRefLog
Whether to disable reflog- Parameters:
disable
- iftrue
disables writing a reflog entry for this reset command- Returns:
- this instance
- Since:
- 4.5
-
isReflogDisabled
public boolean isReflogDisabled()Whether reflog is disabled- Returns:
true
if writing reflog is disabled for this reset command- Since:
- 4.5
-
getRefOrHEAD
-
setProgressMonitor
The progress monitor associated with the reset operation. By default, this is set toNullProgressMonitor
- Parameters:
monitor
- aProgressMonitor
- Returns:
this
- Since:
- 4.11
- See Also:
-
resetIndexForPaths
-
resetIndex
- Throws:
IOException
-
checkoutIndex
- Throws:
IOException
GitAPIException
-
resetMerge
- Throws:
IOException
-
resetCherryPick
- Throws:
IOException
-
resetRevert
- Throws:
IOException
-
toString
-