The library is a facade over a java implementation of Git client - JGit. Because JGit does not provide a full-featured high-level API
(on the level of whole git commands), this library groups the JGit low-level API into bigger pieces and exports the API in the form of full Git commandline commands
(e.g. status, commit, checkout, reset, etc.).
Allows clients to work with local Git repositories and invoke a set of Git commands affecting a Git repository.
- Dec 19 '14 API for git stash support.
- Adding few new GitClient's methods handling the git stash support.
The API supports creating and applying patches and deleting and listing saved patches.
- Dec 11 '14 Passing messages from running commands to the caller.
- ProgressMonitor now delivers also informational messages from running commands.
This is useful to obtain messages during e.g. push process when a remote repository
notifies about run push hooks.
- Oct 27 '14 New method exporting a diff between two arbitrary commits or trees.
- Adding new variant of GitClient.exportDiff which works for any
two arbitrary commits. It is also possible to diff between a commit and the working tree
or the Index.
- Jul 1 '14 New method for updating a reference (branch) to a new commit id.
- New method GitClient.cherryPick used to cherry-pick commits and apply them in the
current branch. The command may interrupt its progress and require some user actions
(such as resolve conflicts or commit) and may be continued with different kinds
of operation types passed as its arguments.
- Introduciong new repository state: CHERRY_PICKING and CHERRY_PICKING_RESOLVED
marking the states of the repository when a cherry-picking is not finished or
it requires resolving conflicts.
- Jun 25 '14 New method for updating a reference (branch) to a new commit id.
- Git client accepts the parameter telling the merge command how
to proceed with regard to fast-forward commits. Users may require
either to enforce or to completely eliminate (and always create a merge commit)
- Git Repository instance allows users to query for the current default fast-forward
option via a new getter method.
Get Git client
Before you can run preferred Git commands, you must get an instance of GitClient bound to a specific repository.
GitClient are provided by GitRepository.
GitRepository represents a concrete local Git repository and is always bound to a specific folder.
The correct way to achieve this is to call
Run Git commands
To run a Git command simply call a method mapped to the command on an instance of GitClient.
Control Git command's workflow
You are able to control a Git command's work and listen for warning and error messages and informative messages indicating start and finish of the command via
ProgressMonitor. Every method of
GitClient mapped to a Git command accepts an instance of
ProgressMonitor as a parameter. Through an instance of this class you can cancel a command, an implementation of such a command periodically calls
isCanceled and interrupts its work if the method returns
Its basic implementation at ProgressMonitor.DefaultProgressMonitor supports canceling commands
while implementing other methods as no-op.
Some Git commands may take a noticeable amount of time to finish and waiting that long for the full result returned by the command may not be sufficient. Git API provides a way
to follow the process of building the result of such commands.
Let's say you want to get all revisions from the Git history. The log command is expensive especially on large repositories and you do not want to wait for it to finish but want to
be notified when a single revision from the history is fetched and added to the result. This way you can incrementally present the result in the UI without the need for
waiting indefinitely for the command to finish.
Package org.netbeans.libs.git.progress offers
a set of listeners extending the NotificationListener interface which you can attach to an instance of
GitClient via addNotificationListener()
and through which you can closely monitor building of the result.
This table lists all of the module exported APIs
defined stability classifications. It is generated
based on answers to questions about the architecture
of the module. Read them all
Group of java interfaces
Group of property interfaces
|Interface Name||In/Out||Stability||Specified in What Document?
Where are the sources for the module?
The sources for the module are in the
NetBeans Mercurial repositories.
What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?
No additional setting is needed, direct dependency is enough.
Read more about the implementation in the answers to