The GitPorcelain commands are described in the Git Documentation.
This class only offers methods to construct so-called command classes. Each
GitPorcelain command is represented by one command class.
Example: this class offers a commit() method returning an instance of
the CommitCommand class. The CommitCommand class has setters
for all the arguments and options. The CommitCommand class also has a
call method to actually execute the commit. The following code show's
how to do a simple commit:
Git git = new Git(myRepo);
git.commit().setMessage("Fix393").setAuthor(developerIdent).call();
All mandatory parameters for commands have to be specified in the methods of
this class, the optional parameters have to be specified by the
setter-methods of the Command class.
This class is intended to be used internally (e.g. by JGit tests) or by external components (EGit, third-party tools) when they need exactly the functionality of a GitPorcelain command. There are use-cases where this class is not optimal and where you should use the more low-level JGit classes. The methods in this class may for example offer too much functionality or they offer the functionality with the wrong arguments.
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final Repository | repo
The git repository this class is interacting with |
| Access | Constructor and Description |
|---|---|
| public | Git(Repository
the git repository this class is interacting with;
repo)null is not allowed.Construct a new |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public AddCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the Add
commandReturn a command object to execute a |
| public ApplyCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the apply
commandReturn a command object to execute a |
| public ArchiveCommand | Returns: aorg.Return a command to create an archive from a tree |
| public BlameCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the blame
commandReturn a command object to execute a |
| public CreateBranchCommand | Returns: aorg.Return a command object used to create branches |
| public DeleteBranchCommand | Returns: aorg.Return a command object used to delete branches |
| public ListBranchCommand | Returns: aorg.Return a command object used to list branches |
| public RenameBranchCommand | Returns: aorg.Return a command object used to rename branches |
| public CheckoutCommand | Returns: aorg. used to collect
all optional parameters and to finally execute the
checkout commandReturn a command object to execute a |
| public CherryPickCommand | Returns: aorg. used to collect
all optional parameters and to finally execute the
cherry-pick commandReturn a command object to execute a |
| public CleanCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the clean
commandReturn a command object to execute a |
| public static CloneCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the clone
commandReturn a command object to execute a |
| public void | close()
Implements java. Closes this resource, relinquishing any underlying resources. |
| public CommitCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the Commit
commandReturn a command object to execute a |
| public DescribeCommand | Returns: aorg..Return a command object to come up with a short name that describes a commit in terms of the nearest git tag. |
| public DiffCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the diff
commandReturn a command object to execute a |
| public FetchCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the Fetch
commandReturn a command object to execute a |
| public GarbageCollectCommand | Returns: aorg. used to
collect all optional parameters and to finally execute the
gc commandReturn a command object to execute a |
| public Repository | Returns: the git repository this class is interacting with; seeclose() for notes on closing this repository.Get repository |
| public static InitCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the init
commandReturn a command object to execute a |
| public LogCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the Log
commandReturn a command object to execute a |
| public LsRemoteCommand | Returns: aorg. used to collect
all optional parameters and to finally execute the status
commandReturn a command object to execute a |
| public static LsRemoteCommand | Returns: aorg.Return a command to list remote branches/tags without a local repository. |
| public MergeCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the Merge
commandReturn a command object to execute a |
| public NameRevCommand | Returns: aorg..Return a command object to find human-readable names of revisions. |
| public AddNoteCommand | |
| public ListNotesCommand | |
| public RemoveNoteCommand | Returns: aorg.Return a command to remove notes on an object |
| public ShowNoteCommand | Returns: aorg.Return a command to show notes on an object |
| public static Git | Returns: aorg. object for the existing git
repositorythe repository to open. May be either the GIT_DIR, or the
working tree directory that contains dir).git.Open repository |
| public static Git | Returns: aorg. object for the existing git
repository. Closing this instance will close the repo.the repository to open. May be either the GIT_DIR, or the
working tree directory that contains dir, FS .git.filesystem abstraction to use when accessing the repository. fs)Open repository |
| public PackRefsCommand | Returns: aorg.Return a command object to execute a |
| public PullCommand | |
| public PushCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the Push
commandReturn a command object to execute a |
| public RebaseCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the rebase
commandReturn a command object to execute a |
| public ReflogCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the reflog
commandReturn a command object to execute a |
| public RemoteAddCommand | Returns: aorg.Return a command used to add a new remote. |
| public RemoteListCommand | Returns: aorg.Return a command used to list the available remotes. |
| public RemoteRemoveCommand | Returns: aorg.Return a command used to remove an existing remote. |
| public RemoteSetUrlCommand | Returns: aorg.Return a command used to change the URL of an existing remote. |
| public ResetCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the reset
commandReturn a command object to execute a |
| public RevertCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the
cherry-pick commandReturn a command object to execute a |
| public RmCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the rm commandReturn a command object to execute a |
| public static void | |
| public StashApplyCommand | Returns: aorg.Returs a command object used to apply a stashed commit |
| public StashCreateCommand | Returns: aorg.Return a command object used to create a stashed commit |
| public StashDropCommand | Returns: aorg.Return a command object used to drop a stashed commit |
| public StashListCommand | Returns: aorg.Return a command object used to list stashed commits |
| public StatusCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the status
commandReturn a command object to execute a |
| public SubmoduleAddCommand | Returns: aorg. used to add a
new submodule to a parent repositoryReturn a command object to execute a |
| public SubmoduleDeinitCommand | Returns: aorg. used to
remove a submodule's working tree manifestationReturns a command object to execute a |
| public SubmoduleInitCommand | Returns: aorg. used to
initialize the repository's config with settings from the
.gitmodules file in the working treeReturn a command object to execute a |
| public SubmoduleStatusCommand | Returns: aorg. used to
report the status of a repository's configured submodulesReturns a command object to execute a |
| public SubmoduleSyncCommand | Returns: aorg. used to
update the URL of a submodule from the parent repository's
.gitmodules fileReturn a command object to execute a |
| public SubmoduleUpdateCommand | Returns: aorg. used to
update the submodules in a repository to the configured revisionReturn a command object to execute a |
| public TagCommand | Returns: aorg. used to collect all
optional parameters and to finally execute the Tag
commandReturn a command object to execute a |
| public DeleteTagCommand | Returns: aorg.Return a command object used to delete tags |
| public ListTagCommand | |
| public String | |
| public VerifySignatureCommand | Returns: aVerifySignatureCommandReturn a command to verify signatures of tags or commits. |
| public static Git | Returns: aorg. object for the existing git
repository. The caller is responsible for closing the repository;
close() on this instance does not close the repo.the git repository this class is interacting with;
repo)null is not allowed.Wrap repository |
| closeRepo | back to summary |
|---|---|
| private final boolean closeRepo | |
| repo | back to summary |
|---|---|
| private final Repository repo The git repository this class is interacting with | |
| Git | back to summary |
|---|---|
| public Git(Repository repo) Construct a new All command classes returned by methods of this class will always interact with this git repository.
The caller is responsible for closing the repository;
| |
| Git | back to summary |
|---|---|
| pack-priv Git(Repository repo, boolean closeRepo) | |
| add | back to summary |
|---|---|
| public AddCommand add() Return a command object to execute a
| |
| apply | back to summary |
|---|---|
| public ApplyCommand apply() Return a command object to execute a
| |
| archive | back to summary |
|---|---|
| public ArchiveCommand archive() Return a command to create an archive from a tree
| |
| blame | back to summary |
|---|---|
| public BlameCommand blame() Return a command object to execute a
| |
| branchCreate | back to summary |
|---|---|
| public CreateBranchCommand branchCreate() Return a command object used to create branches | |
| branchDelete | back to summary |
|---|---|
| public DeleteBranchCommand branchDelete() Return a command object used to delete branches | |
| branchList | back to summary |
|---|---|
| public ListBranchCommand branchList() Return a command object used to list branches | |
| branchRename | back to summary |
|---|---|
| public RenameBranchCommand branchRename() Return a command object used to rename branches | |
| checkout | back to summary |
|---|---|
| public CheckoutCommand checkout() Return a command object to execute a
| |
| cherryPick | back to summary |
|---|---|
| public CherryPickCommand cherryPick() Return a command object to execute a
| |
| clean | back to summary |
|---|---|
| public CleanCommand clean() Return a command object to execute a
| |
| cloneRepository | back to summary |
|---|---|
| public static CloneCommand cloneRepository() Return a command object to execute a
| |
| close | back to summary |
|---|---|
| public void close() Implements java. Doc from java. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
Free resources associated with this instance.
If the repository was opened by a static factory method in this class,
then this method calls
If the repository was created by a caller and passed into
In all cases, after calling this method you should not use this
| |
| commit | back to summary |
|---|---|
| public CommitCommand commit() Return a command object to execute a
| |
| describe | back to summary |
|---|---|
| public DescribeCommand describe() Return a command object to come up with a short name that describes a commit in terms of the nearest git tag.
| |
| diff | back to summary |
|---|---|
| public DiffCommand diff() Return a command object to execute a
| |
| fetch | back to summary |
|---|---|
| public FetchCommand fetch() Return a command object to execute a
| |
| gc | back to summary |
|---|---|
| public GarbageCollectCommand gc() Return a command object to execute a
| |
| getRepository | back to summary |
|---|---|
| public Repository getRepository() Get repository
| |
| init | back to summary |
|---|---|
| public static InitCommand init() Return a command object to execute a
| |
| log | back to summary |
|---|---|
| public LogCommand log() Return a command object to execute a
| |
| lsRemote | back to summary |
|---|---|
| public LsRemoteCommand lsRemote() Return a command object to execute a
| |
| lsRemoteRepository | back to summary |
|---|---|
| public static LsRemoteCommand lsRemoteRepository() Return a command to list remote branches/tags without a local repository.
| |
| merge | back to summary |
|---|---|
| public MergeCommand merge() Return a command object to execute a
| |
| nameRev | back to summary |
|---|---|
| public NameRevCommand nameRev() Return a command object to find human-readable names of revisions.
| |
| notesAdd | back to summary |
|---|---|
| public AddNoteCommand notesAdd() Return a command to add notes to an object | |
| notesList | back to summary |
|---|---|
| public ListNotesCommand notesList() Return a command to list all notes | |
| notesRemove | back to summary |
|---|---|
| public RemoveNoteCommand notesRemove() Return a command to remove notes on an object | |
| notesShow | back to summary |
|---|---|
| public ShowNoteCommand notesShow() Return a command to show notes on an object | |
| open | back to summary |
|---|---|
| public static Git open(File dir) throws IOException Open repository
| |
| open | back to summary |
|---|---|
| public static Git open(File dir, FS fs) throws IOException Open repository
| |
| packRefs | back to summary |
|---|---|
| public PackRefsCommand packRefs() Return a command object to execute a
| |
| pull | back to summary |
|---|---|
| public PullCommand pull() Return a command object to execute a | |
| push | back to summary |
|---|---|
| public PushCommand push() Return a command object to execute a
| |
| rebase | back to summary |
|---|---|
| public RebaseCommand rebase() Return a command object to execute a
| |
| reflog | back to summary |
|---|---|
| public ReflogCommand reflog() Return a command object to execute a
| |
| remoteAdd | back to summary |
|---|---|
| public RemoteAddCommand remoteAdd() Return a command used to add a new remote.
| |
| remoteList | back to summary |
|---|---|
| public RemoteListCommand remoteList() Return a command used to list the available remotes.
| |
| remoteRemove | back to summary |
|---|---|
| public RemoteRemoveCommand remoteRemove() Return a command used to remove an existing remote.
| |
| remoteSetUrl | back to summary |
|---|---|
| public RemoteSetUrlCommand remoteSetUrl() Return a command used to change the URL of an existing remote.
| |
| reset | back to summary |
|---|---|
| public ResetCommand reset() Return a command object to execute a
| |
| revert | back to summary |
|---|---|
| public RevertCommand revert() Return a command object to execute a
| |
| rm | back to summary |
|---|---|
| public RmCommand rm() Return a command object to execute a
| |
| shutdown | back to summary |
|---|---|
| public static void shutdown() Shutdown JGit and release resources it holds like NLS and thread pools
| |
| stashApply | back to summary |
|---|---|
| public StashApplyCommand stashApply() Returs a command object used to apply a stashed commit
| |
| stashCreate | back to summary |
|---|---|
| public StashCreateCommand stashCreate() Return a command object used to create a stashed commit
| |
| stashDrop | back to summary |
|---|---|
| public StashDropCommand stashDrop() Return a command object used to drop a stashed commit
| |
| stashList | back to summary |
|---|---|
| public StashListCommand stashList() Return a command object used to list stashed commits | |
| status | back to summary |
|---|---|
| public StatusCommand status() Return a command object to execute a
| |
| submoduleAdd | back to summary |
|---|---|
| public SubmoduleAddCommand submoduleAdd() Return a command object to execute a
| |
| submoduleDeinit | back to summary |
|---|---|
| public SubmoduleDeinitCommand submoduleDeinit() Returns a command object to execute a
| |
| submoduleInit | back to summary |
|---|---|
| public SubmoduleInitCommand submoduleInit() Return a command object to execute a
| |
| submoduleStatus | back to summary |
|---|---|
| public SubmoduleStatusCommand submoduleStatus() Returns a command object to execute a
| |
| submoduleSync | back to summary |
|---|---|
| public SubmoduleSyncCommand submoduleSync() Return a command object to execute a
| |
| submoduleUpdate | back to summary |
|---|---|
| public SubmoduleUpdateCommand submoduleUpdate() Return a command object to execute a
| |
| tag | back to summary |
|---|---|
| public TagCommand tag() Return a command object to execute a
| |
| tagDelete | back to summary |
|---|---|
| public DeleteTagCommand tagDelete() Return a command object used to delete tags | |
| tagList | back to summary |
|---|---|
| public ListTagCommand tagList() Return a command object used to list tags | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| verifySignature | back to summary |
|---|---|
| public VerifySignatureCommand verifySignature() Return a command to verify signatures of tags or commits.
| |
| wrap | back to summary |
|---|---|
| public static Git wrap(Repository repo) Wrap repository
| |