Package org.eclipse.jgit.api
Class StashCreateCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<RevCommit>
-
- org.eclipse.jgit.api.StashCreateCommand
-
public class StashCreateCommand extends GitCommand<RevCommit>
Command class to stash changes in the working directory and index in a commit.- Since:
- 2.0
- See Also:
- Git documentation about Stash
-
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Constructor Description StashCreateCommand(Repository repo)
Create a command to stash changes in the working directory and index
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RevCommit
call()
StashCreateCommand
setIncludeUntracked(boolean includeUntracked)
Whether to include untracked files in the stash.StashCreateCommand
setIndexMessage(String message)
Set the message used when committing index changesStashCreateCommand
setPerson(PersonIdent person)
Set the person to use as the author and committer in the commits madeStashCreateCommand
setRef(String ref)
Set the reference to update with the stashed commit id If null, no reference is updatedStashCreateCommand
setWorkingDirectoryMessage(String message)
Set the message used when committing working directory changes-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
StashCreateCommand
public StashCreateCommand(Repository repo)
Create a command to stash changes in the working directory and index- Parameters:
repo
- aRepository
object.
-
-
Method Detail
-
setIndexMessage
public StashCreateCommand setIndexMessage(String message)
Set the message used when committing index changesThe message will be formatted with the current branch, abbreviated commit id, and short commit message when used.
- Parameters:
message
- the stash message- Returns:
this
-
setWorkingDirectoryMessage
public StashCreateCommand setWorkingDirectoryMessage(String message)
Set the message used when committing working directory changesThe message will be formatted with the current branch, abbreviated commit id, and short commit message when used.
- Parameters:
message
- the working directory message- Returns:
this
-
setPerson
public StashCreateCommand setPerson(PersonIdent person)
Set the person to use as the author and committer in the commits made- Parameters:
person
- thePersonIdent
of the person who creates the stash.- Returns:
this
-
setRef
public StashCreateCommand setRef(String ref)
Set the reference to update with the stashed commit id If null, no reference is updatedThis value defaults to
Constants.R_STASH
- Parameters:
ref
- the name of theRef
to update- Returns:
this
-
setIncludeUntracked
public StashCreateCommand setIncludeUntracked(boolean includeUntracked)
Whether to include untracked files in the stash.- Parameters:
includeUntracked
- whether to include untracked files in the stash- Returns:
this
- Since:
- 3.4
-
call
public RevCommit call() throws GitAPIException
Execute the command
Stash the contents on the working directory and index in separate commits and reset to the current HEAD commit.
- Specified by:
call
in interfaceCallable<RevCommit>
- Specified by:
call
in classGitCommand<RevCommit>
- Throws:
GitAPIException
-
-