Package org.eclipse.jgit.api
Class ResetCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<Ref>
-
- org.eclipse.jgit.api.ResetCommand
-
public class ResetCommand extends GitCommand<Ref>
A class used to execute aResetcommand. It has setters for all supported options and arguments of this command and acall()method to finally execute the command. Each instance of this class should only be used for one invocation of the command (means: one call tocall())- See Also:
- Git documentation about Reset
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResetCommand.ResetTypeKind of reset
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Constructor Description ResetCommand(Repository repo)Constructor for ResetCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResetCommandaddPath(String path)Repository relative path of file or directory to resetRefcall()ResetCommanddisableRefLog(boolean disable)Whether to disable reflogbooleanisReflogDisabled()Whether reflog is disabledResetCommandsetMode(ResetCommand.ResetType mode)Set the reset modeResetCommandsetProgressMonitor(ProgressMonitor monitor)The progress monitor associated with the reset operation.ResetCommandsetRef(String ref)Set the name of theRefto reset toStringtoString()-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
ResetCommand
public ResetCommand(Repository repo)
Constructor for ResetCommand.
- Parameters:
repo- theRepository
-
-
Method Detail
-
call
public Ref call() throws GitAPIException, CheckoutConflictException
Execute the command
Executes the
Resetcommand. 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:
callin interfaceCallable<Ref>- Specified by:
callin classGitCommand<Ref>- Throws:
GitAPIExceptionCheckoutConflictException
-
setRef
public ResetCommand setRef(String ref)
Set the name of theRefto reset to- Parameters:
ref- the ref to reset to, defaults to HEAD if not specified- Returns:
- this instance
-
setMode
public ResetCommand setMode(ResetCommand.ResetType mode)
Set the reset mode- Parameters:
mode- the mode of the reset command- Returns:
- this instance
-
addPath
public ResetCommand addPath(String path)
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
public ResetCommand disableRefLog(boolean disable)
Whether to disable reflog- Parameters:
disable- iftruedisables writing a reflog entry for this reset command- Returns:
- this instance
- Since:
- 4.5
-
isReflogDisabled
public boolean isReflogDisabled()
Whether reflog is disabled- Returns:
trueif writing reflog is disabled for this reset command- Since:
- 4.5
-
setProgressMonitor
public ResetCommand setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the reset operation. By default, this is set toNullProgressMonitor- Parameters:
monitor- aProgressMonitor- Returns:
this- Since:
- 4.11
- See Also:
NullProgressMonitor
-
-