public final class GitRepository extends Object
Instances are bound to a local folder with actual Git repository. If the repository does not exist yet, you
still have to provide a local file which indicates where the repository would be created when
GitClient.init(org.netbeans.libs.git.progress.ProgressMonitor) was called.
To get an instance of
GitClient to run git commands with, use
createClient() method. It always returns
a new instance of the
GitClient, it is not shared among the callers.
When done with the client - you finish calling all desired commands and do not
plan to use the client's instance any more -
GitClient.release() must be called.
When all created clients are released this way, repository metadata are flushed,
all open metadata files are closed and thus do not block any external tools
(such as a commandline client).
Internally the class keeps a map of its instances that are cached under
a weak reference to the instance of the local file passed in the
Along with the instance it caches also all repository metadata (branches, index, references etc.)
needed to construct the client and operate with the actual Git repository.
Every call to the
getInstance method with the same instance of the file
will always return the same instance of
GitRepository. It is up to a caller's
responsibility to hold a strong reference to the file so a created client always works with
the same instance of the git repository.
|Modifier and Type||Class and Description|
Option specifying how to deal with merges and merge commits.
|Modifier and Type||Method and Description|
Creates and returns always a new instance of git client bound to the local git repository.
Parses the repository configuration file and returns the default fast-forward merge option set for the repository and its current branch.
Returns the instance of
public static GitRepository getInstance(File repositoryLocation)
GitRepositoryrepresenting an existing or not yet existing repository specified by the given local folder.
repositoryLocation- repository root location, the file may or may not exist. If you plan to create a local new repository, the repository will be created at this location.
public GitClient createClient() throws GitException
GitException- when an error occurs while loading repository data from disk.
public GitRepository.FastForwardOption getDefaultFastForwardOption() throws GitException
GitException- an error occurs
Built on January 18 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.