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 aReset
command. 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 class
ResetCommand.ResetType
Kind of reset
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Constructor Description ResetCommand(Repository repo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResetCommand
addPath(String path)
Ref
call()
Executes theReset
command.ResetCommand
setMode(ResetCommand.ResetType mode)
ResetCommand
setRef(String ref)
-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
ResetCommand
public ResetCommand(Repository repo)
- Parameters:
repo
-
-
-
Method Detail
-
call
public Ref call() throws GitAPIException, CheckoutConflictException
Executes theReset
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>
- Returns:
- the Ref after reset
- Throws:
GitAPIException
CheckoutConflictException
-
setRef
public ResetCommand setRef(String ref)
- Parameters:
ref
- the ref to reset to, defaults to HEAD if not specified- Returns:
- this instance
-
setMode
public ResetCommand setMode(ResetCommand.ResetType mode)
- Parameters:
mode
- the mode of the reset command- Returns:
- this instance
-
addPath
public ResetCommand addPath(String path)
- Parameters:
path
- repository-relative path of file/directory to reset (with/
as separator)- Returns:
- this instance
-
-