Skip navigation links
org.netbeans.libs.git/1 1.59

Git Client Library
Under Development

See: Description

Git Client Library 
Package Description
org.netbeans.libs.git  
org.netbeans.libs.git.progress  

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.). GitlibraryAPI Allows clients to work with local Git repositories and invoke a set of Git commands affecting a Git repository.

What is New (see all changes)?

Use Cases

Get Git client
Before you can run preferred Git commands, you must get an instance of GitClient bound to a specific repository.
Instances of 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 GitRepository.getInstance(repositoryRoot).createClient().
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 true.
Its basic implementation at ProgressMonitor.DefaultProgressMonitor supports canceling commands while implementing other methods as no-op.
Recieve notifications
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.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
GitlibraryAPIExportedUnder Development

Allows clients to work with local Git repositories and invoke a set of Git commands affecting a Git repository.

Group of property interfaces
Interface NameIn/OutStabilitySpecified in What Document?

Implementation Details

Where are the sources for the module?

The sources for the module are in the Apache Git repositories or in the GitHub 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 architecture questions.

Skip navigation links
org.netbeans.libs.git/1 1.59