org.eclipse.jgit.api
Class StashApplyCommand
java.lang.Object
org.eclipse.jgit.api.GitCommand<ObjectId>
org.eclipse.jgit.api.StashApplyCommand
- All Implemented Interfaces:
- Callable<ObjectId>
public class StashApplyCommand
- extends GitCommand<ObjectId>
Command class to apply a stashed commit.
This class behaves like git stash apply --index, i.e. it tries to
recover the stashed index state in addition to the working tree state.
- Since:
- 2.0
- See Also:
- Git documentation about Stash
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StashApplyCommand
public StashApplyCommand(Repository repo)
- Create command to apply the changes of a stashed commit
- Parameters:
repo
-
setStashRef
public StashApplyCommand setStashRef(String stashRef)
- Set the stash reference to apply
This will default to apply the latest stashed commit (stash@{0}) if
unspecified
- Parameters:
stashRef
-
- Returns:
this
call
public ObjectId call()
throws GitAPIException,
WrongRepositoryStateException,
NoHeadException,
StashApplyFailureException
- Apply the changes in a stashed commit to the working directory and index
- Specified by:
call
in interface Callable<ObjectId>
- Specified by:
call
in class GitCommand<ObjectId>
- Returns:
- id of stashed commit that was applied TODO: Does anyone depend on
this, or could we make it more like Merge/CherryPick/Revert?
- Throws:
GitAPIException
WrongRepositoryStateException
NoHeadException
StashApplyFailureException
setApplyIndex
public void setApplyIndex(boolean applyIndex)
- Parameters:
applyIndex
- true (default) if the command should restore the index state
Copyright © 2013. All Rights Reserved.