Top Description Fields Constructors Methods
org.eclipse.jgit.api

public Class Git

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Static Imports
java.util.Objects.requireNonNull

Offers a "GitPorcelain"-like API to interact with a git repository.

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.

Field Summary

Modifier and TypeField and Description
private final boolean
private final Repository
repo

The git repository this class is interacting with

Constructor Summary

AccessConstructor and Description
public
Git(Repository
the git repository this class is interacting with; null is not allowed.
repo
)

Construct a new org.eclipse.jgit.api.Git object which can interact with the specified git repository.

pack-priv
Git(Repository repo, boolean closeRepo)

Method Summary

Modifier and TypeMethod and Description
public AddCommand

Returns:

a org.eclipse.jgit.api.AddCommand used to collect all optional parameters and to finally execute the Add command
add
()

Return a command object to execute a Add command

public ApplyCommand

Returns:

a org.eclipse.jgit.api.ApplyCommand used to collect all optional parameters and to finally execute the apply command
apply
()

Return a command object to execute a apply command

public ArchiveCommand
archive()

Return a command to create an archive from a tree

public BlameCommand

Returns:

a org.eclipse.jgit.api.BlameCommand used to collect all optional parameters and to finally execute the blame command
blame
()

Return a command object to execute a blame command

public CreateBranchCommand
branchCreate()

Return a command object used to create branches

public DeleteBranchCommand
branchDelete()

Return a command object used to delete branches

public ListBranchCommand
branchList()

Return a command object used to list branches

public RenameBranchCommand
branchRename()

Return a command object used to rename branches

public CheckoutCommand

Returns:

a org.eclipse.jgit.api.CheckoutCommand used to collect all optional parameters and to finally execute the checkout command
checkout
()

Return a command object to execute a checkout command

public CherryPickCommand

Returns:

a org.eclipse.jgit.api.CherryPickCommand used to collect all optional parameters and to finally execute the cherry-pick command
cherryPick
()

Return a command object to execute a cherry-pick command

public CleanCommand

Returns:

a org.eclipse.jgit.api.CleanCommand used to collect all optional parameters and to finally execute the clean command
clean
()

Return a command object to execute a clean command

public static CloneCommand

Returns:

a org.eclipse.jgit.api.CloneCommand used to collect all optional parameters and to finally execute the clone command
cloneRepository
()

Return a command object to execute a clone command

public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public CommitCommand

Returns:

a org.eclipse.jgit.api.CommitCommand used to collect all optional parameters and to finally execute the Commit command
commit
()

Return a command object to execute a Commit command

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.

public DiffCommand

Returns:

a org.eclipse.jgit.api.DiffCommand used to collect all optional parameters and to finally execute the diff command
diff
()

Return a command object to execute a diff command

public FetchCommand

Returns:

a org.eclipse.jgit.api.FetchCommand used to collect all optional parameters and to finally execute the Fetch command
fetch
()

Return a command object to execute a Fetch command

public GarbageCollectCommand

Returns:

a org.eclipse.jgit.api.GarbageCollectCommand used to collect all optional parameters and to finally execute the gc command
gc
()

Return a command object to execute a gc command

public Repository

Returns:

the git repository this class is interacting with; see close() for notes on closing this repository.
getRepository
()

Get repository

public static InitCommand

Returns:

a org.eclipse.jgit.api.InitCommand used to collect all optional parameters and to finally execute the init command
init
()

Return a command object to execute a init command

public LogCommand

Returns:

a org.eclipse.jgit.api.LogCommand used to collect all optional parameters and to finally execute the Log command
log
()

Return a command object to execute a Log command

public LsRemoteCommand

Returns:

a org.eclipse.jgit.api.LsRemoteCommand used to collect all optional parameters and to finally execute the status command
lsRemote
()

Return a command object to execute a ls-remote command

public static LsRemoteCommand
lsRemoteRepository()

Return a command to list remote branches/tags without a local repository.

public MergeCommand

Returns:

a org.eclipse.jgit.api.MergeCommand used to collect all optional parameters and to finally execute the Merge command
merge
()

Return a command object to execute a Merge command

public NameRevCommand
nameRev()

Return a command object to find human-readable names of revisions.

public AddNoteCommand
notesAdd()

Return a command to add notes to an object

public ListNotesCommand
notesList()

Return a command to list all notes

public RemoveNoteCommand
notesRemove()

Return a command to remove notes on an object

public ShowNoteCommand
notesShow()

Return a command to show notes on an object

public static Git

Returns:

a org.eclipse.jgit.api.Git object for the existing git repository
open
(File
the repository to open. May be either the GIT_DIR, or the working tree directory that contains .git.
dir
)

Open repository

public static Git

Returns:

a org.eclipse.jgit.api.Git object for the existing git repository. Closing this instance will close the repo.
open
(File
the repository to open. May be either the GIT_DIR, or the working tree directory that contains .git.
dir
,
FS
filesystem abstraction to use when accessing the repository.
fs
)

Open repository

public PackRefsCommand
packRefs()

Return a command object to execute a PackRefs command

public PullCommand
pull()

Return a command object to execute a Pull command

public PushCommand

Returns:

a org.eclipse.jgit.api.PushCommand used to collect all optional parameters and to finally execute the Push command
push
()

Return a command object to execute a Push command

public RebaseCommand

Returns:

a org.eclipse.jgit.api.RebaseCommand used to collect all optional parameters and to finally execute the rebase command
rebase
()

Return a command object to execute a Rebase command

public ReflogCommand

Returns:

a org.eclipse.jgit.api.ReflogCommand used to collect all optional parameters and to finally execute the reflog command
reflog
()

Return a command object to execute a reflog command

public RemoteAddCommand
remoteAdd()

Return a command used to add a new remote.

public RemoteListCommand
remoteList()

Return a command used to list the available remotes.

public RemoteRemoveCommand
remoteRemove()

Return a command used to remove an existing remote.

public RemoteSetUrlCommand
remoteSetUrl()

Return a command used to change the URL of an existing remote.

public ResetCommand

Returns:

a org.eclipse.jgit.api.ResetCommand used to collect all optional parameters and to finally execute the reset command
reset
()

Return a command object to execute a reset command

public RevertCommand

Returns:

a org.eclipse.jgit.api.RevertCommand used to collect all optional parameters and to finally execute the cherry-pick command
revert
()

Return a command object to execute a revert command

public RmCommand

Returns:

a org.eclipse.jgit.api.RmCommand used to collect all optional parameters and to finally execute the rm command
rm
()

Return a command object to execute a rm command

public static void
shutdown()

Shutdown JGit and release resources it holds like NLS and thread pools

public StashApplyCommand
stashApply()

Returs a command object used to apply a stashed commit

public StashCreateCommand
stashCreate()

Return a command object used to create a stashed commit

public StashDropCommand
stashDrop()

Return a command object used to drop a stashed commit

public StashListCommand
stashList()

Return a command object used to list stashed commits

public StatusCommand

Returns:

a org.eclipse.jgit.api.StatusCommand used to collect all optional parameters and to finally execute the status command
status
()

Return a command object to execute a status command

public SubmoduleAddCommand

Returns:

a org.eclipse.jgit.api.SubmoduleAddCommand used to add a new submodule to a parent repository
submoduleAdd
()

Return a command object to execute a submodule add command

public SubmoduleDeinitCommand

Returns:

a org.eclipse.jgit.api.SubmoduleDeinitCommand used to remove a submodule's working tree manifestation
submoduleDeinit
()

Returns a command object to execute a submodule deinit command

public SubmoduleInitCommand

Returns:

a org.eclipse.jgit.api.SubmoduleInitCommand used to initialize the repository's config with settings from the .gitmodules file in the working tree
submoduleInit
()

Return a command object to execute a submodule init command

public SubmoduleStatusCommand

Returns:

a org.eclipse.jgit.api.SubmoduleStatusCommand used to report the status of a repository's configured submodules
submoduleStatus
()

Returns a command object to execute a submodule status command

public SubmoduleSyncCommand

Returns:

a org.eclipse.jgit.api.SubmoduleSyncCommand used to update the URL of a submodule from the parent repository's .gitmodules file
submoduleSync
()

Return a command object to execute a submodule sync command

public SubmoduleUpdateCommand

Returns:

a org.eclipse.jgit.api.SubmoduleUpdateCommand used to update the submodules in a repository to the configured revision
submoduleUpdate
()

Return a command object to execute a submodule update command

public TagCommand

Returns:

a org.eclipse.jgit.api.TagCommand used to collect all optional parameters and to finally execute the Tag command
tag
()

Return a command object to execute a Tag command

public DeleteTagCommand
tagDelete()

Return a command object used to delete tags

public ListTagCommand
tagList()

Return a command object used to list tags

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public VerifySignatureCommand
verifySignature()

Return a command to verify signatures of tags or commits.

public static Git

Returns:

a org.eclipse.jgit.api.Git object for the existing git repository. The caller is responsible for closing the repository; close() on this instance does not close the repo.
wrap
(Repository
the git repository this class is interacting with; null is not allowed.
repo
)

Wrap repository

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

closeRepoback to summary
private final boolean closeRepo
repoback to summary
private final Repository repo

The git repository this class is interacting with

Constructor Detail

Gitback to summary
public Git(Repository repo)

Construct a new org.eclipse.jgit.api.Git object which can interact with the specified git repository.

All command classes returned by methods of this class will always interact with this git repository.

The caller is responsible for closing the repository; close() on this instance does not close the repo.

Parameters
repo:Repository

the git repository this class is interacting with; null is not allowed.

Gitback to summary
pack-priv Git(Repository repo, boolean closeRepo)

Method Detail

addback to summary
public AddCommand add()

Return a command object to execute a Add command

Returns:AddCommand

a org.eclipse.jgit.api.AddCommand used to collect all optional parameters and to finally execute the Add command

See Also
Git documentation about Add
applyback to summary
public ApplyCommand apply()

Return a command object to execute a apply command

Returns:ApplyCommand

a org.eclipse.jgit.api.ApplyCommand used to collect all optional parameters and to finally execute the apply command

Since
2.0
See Also
Git documentation about apply
archiveback to summary
public ArchiveCommand archive()

Return a command to create an archive from a tree

Returns:ArchiveCommand

a org.eclipse.jgit.api.ArchiveCommand

Since
3.1
blameback to summary
public BlameCommand blame()

Return a command object to execute a blame command

Returns:BlameCommand

a org.eclipse.jgit.api.BlameCommand used to collect all optional parameters and to finally execute the blame command

See Also
Git documentation about Blame
branchCreateback to summary
public CreateBranchCommand branchCreate()

Return a command object used to create branches

Returns:CreateBranchCommand

a org.eclipse.jgit.api.CreateBranchCommand

branchDeleteback to summary
public DeleteBranchCommand branchDelete()

Return a command object used to delete branches

Returns:DeleteBranchCommand

a org.eclipse.jgit.api.DeleteBranchCommand

branchListback to summary
public ListBranchCommand branchList()

Return a command object used to list branches

Returns:ListBranchCommand

a org.eclipse.jgit.api.ListBranchCommand

branchRenameback to summary
public RenameBranchCommand branchRename()

Return a command object used to rename branches

Returns:RenameBranchCommand

a org.eclipse.jgit.api.RenameBranchCommand

checkoutback to summary
public CheckoutCommand checkout()

Return a command object to execute a checkout command

Returns:CheckoutCommand

a org.eclipse.jgit.api.CheckoutCommand used to collect all optional parameters and to finally execute the checkout command

See Also
Git documentation about checkout
cherryPickback to summary
public CherryPickCommand cherryPick()

Return a command object to execute a cherry-pick command

Returns:CherryPickCommand

a org.eclipse.jgit.api.CherryPickCommand used to collect all optional parameters and to finally execute the cherry-pick command

See Also
Git documentation about cherry-pick
cleanback to summary
public CleanCommand clean()

Return a command object to execute a clean command

Returns:CleanCommand

a org.eclipse.jgit.api.CleanCommand used to collect all optional parameters and to finally execute the clean command

See Also
Git documentation about Clean
cloneRepositoryback to summary
public static CloneCommand cloneRepository()

Return a command object to execute a clone command

Returns:CloneCommand

a org.eclipse.jgit.api.CloneCommand used to collect all optional parameters and to finally execute the clone command

See Also
Git documentation about clone
closeback to summary
public void close()

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Free resources associated with this instance.

If the repository was opened by a static factory method in this class, then this method calls Repository#close() on the underlying repository instance. (Whether this actually releases underlying resources, such as file handles, may vary; see Repository for more details.)

If the repository was created by a caller and passed into Git(Repository) or a static factory method in this class, then this method does not call close on the underlying repository.

In all cases, after calling this method you should not use this Git instance anymore.

Annotations
@Override
Since
3.2
commitback to summary
public CommitCommand commit()

Return a command object to execute a Commit command

Returns:CommitCommand

a org.eclipse.jgit.api.CommitCommand used to collect all optional parameters and to finally execute the Commit command

See Also
Git documentation about Commit
describeback 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.

Returns:DescribeCommand

a org.eclipse.jgit.api.DescribeCommand.

Since
3.2
diffback to summary
public DiffCommand diff()

Return a command object to execute a diff command

Returns:DiffCommand

a org.eclipse.jgit.api.DiffCommand used to collect all optional parameters and to finally execute the diff command

See Also
Git documentation about diff
fetchback to summary
public FetchCommand fetch()

Return a command object to execute a Fetch command

Returns:FetchCommand

a org.eclipse.jgit.api.FetchCommand used to collect all optional parameters and to finally execute the Fetch command

See Also
Git documentation about Fetch
gcback to summary
public GarbageCollectCommand gc()

Return a command object to execute a gc command

Returns:GarbageCollectCommand

a org.eclipse.jgit.api.GarbageCollectCommand used to collect all optional parameters and to finally execute the gc command

Since
2.2
See Also
Git documentation about gc
getRepositoryback to summary
public Repository getRepository()

Get repository

Returns:Repository

the git repository this class is interacting with; see close() for notes on closing this repository.

initback to summary
public static InitCommand init()

Return a command object to execute a init command

Returns:InitCommand

a org.eclipse.jgit.api.InitCommand used to collect all optional parameters and to finally execute the init command

See Also
Git documentation about init
logback to summary
public LogCommand log()

Return a command object to execute a Log command

Returns:LogCommand

a org.eclipse.jgit.api.LogCommand used to collect all optional parameters and to finally execute the Log command

See Also
Git documentation about Log
lsRemoteback to summary
public LsRemoteCommand lsRemote()

Return a command object to execute a ls-remote command

Returns:LsRemoteCommand

a org.eclipse.jgit.api.LsRemoteCommand used to collect all optional parameters and to finally execute the status command

See Also
Git documentation about ls-remote
lsRemoteRepositoryback to summary
public static LsRemoteCommand lsRemoteRepository()

Return a command to list remote branches/tags without a local repository.

Returns:LsRemoteCommand

a org.eclipse.jgit.api.LsRemoteCommand

Since
3.1
mergeback to summary
public MergeCommand merge()

Return a command object to execute a Merge command

Returns:MergeCommand

a org.eclipse.jgit.api.MergeCommand used to collect all optional parameters and to finally execute the Merge command

See Also
Git documentation about Merge
nameRevback to summary
public NameRevCommand nameRev()

Return a command object to find human-readable names of revisions.

Returns:NameRevCommand

a org.eclipse.jgit.api.NameRevCommand.

Since
3.0
notesAddback to summary
public AddNoteCommand notesAdd()

Return a command to add notes to an object

Returns:AddNoteCommand

a org.eclipse.jgit.api.AddNoteCommand

notesListback to summary
public ListNotesCommand notesList()

Return a command to list all notes

Returns:ListNotesCommand

a org.eclipse.jgit.api.ListNotesCommand

notesRemoveback to summary
public RemoveNoteCommand notesRemove()

Return a command to remove notes on an object

Returns:RemoveNoteCommand

a org.eclipse.jgit.api.RemoveNoteCommand

notesShowback to summary
public ShowNoteCommand notesShow()

Return a command to show notes on an object

Returns:ShowNoteCommand

a org.eclipse.jgit.api.ShowNoteCommand

openback to summary
public static Git open(File dir) throws IOException

Open repository

Parameters
dir:File

the repository to open. May be either the GIT_DIR, or the working tree directory that contains .git.

Returns:Git

a org.eclipse.jgit.api.Git object for the existing git repository

Exceptions
IOException:
if an IO error occurred
openback to summary
public static Git open(File dir, FS fs) throws IOException

Open repository

Parameters
dir:File

the repository to open. May be either the GIT_DIR, or the working tree directory that contains .git.

fs:FS

filesystem abstraction to use when accessing the repository.

Returns:Git

a org.eclipse.jgit.api.Git object for the existing git repository. Closing this instance will close the repo.

Exceptions
IOException:
if an IO error occurred
packRefsback to summary
public PackRefsCommand packRefs()

Return a command object to execute a PackRefs command

Returns:PackRefsCommand

a org.eclipse.jgit.api.PackRefsCommand

Since
7.1
pullback to summary
public PullCommand pull()

Return a command object to execute a Pull command

Returns:PullCommand

a org.eclipse.jgit.api.PullCommand

pushback to summary
public PushCommand push()

Return a command object to execute a Push command

Returns:PushCommand

a org.eclipse.jgit.api.PushCommand used to collect all optional parameters and to finally execute the Push command

See Also
Git documentation about Push
rebaseback to summary
public RebaseCommand rebase()

Return a command object to execute a Rebase command

Returns:RebaseCommand

a org.eclipse.jgit.api.RebaseCommand used to collect all optional parameters and to finally execute the rebase command

See Also
Git documentation about rebase
reflogback to summary
public ReflogCommand reflog()

Return a command object to execute a reflog command

Returns:ReflogCommand

a org.eclipse.jgit.api.ReflogCommand used to collect all optional parameters and to finally execute the reflog command

See Also
Git documentation about reflog
remoteAddback to summary
public RemoteAddCommand remoteAdd()

Return a command used to add a new remote.

Returns:RemoteAddCommand

a org.eclipse.jgit.api.RemoteAddCommand

Since
4.2
remoteListback to summary
public RemoteListCommand remoteList()

Return a command used to list the available remotes.

Returns:RemoteListCommand

a org.eclipse.jgit.api.RemoteListCommand

Since
4.2
remoteRemoveback to summary
public RemoteRemoveCommand remoteRemove()

Return a command used to remove an existing remote.

Returns:RemoteRemoveCommand

a org.eclipse.jgit.api.RemoteRemoveCommand

Since
4.2
remoteSetUrlback to summary
public RemoteSetUrlCommand remoteSetUrl()

Return a command used to change the URL of an existing remote.

Returns:RemoteSetUrlCommand

a org.eclipse.jgit.api.RemoteSetUrlCommand

Since
4.2
resetback to summary
public ResetCommand reset()

Return a command object to execute a reset command

Returns:ResetCommand

a org.eclipse.jgit.api.ResetCommand used to collect all optional parameters and to finally execute the reset command

See Also
Git documentation about reset
revertback to summary
public RevertCommand revert()

Return a command object to execute a revert command

Returns:RevertCommand

a org.eclipse.jgit.api.RevertCommand used to collect all optional parameters and to finally execute the cherry-pick command

See Also
Git documentation about reverting changes
rmback to summary
public RmCommand rm()

Return a command object to execute a rm command

Returns:RmCommand

a org.eclipse.jgit.api.RmCommand used to collect all optional parameters and to finally execute the rm command

See Also
Git documentation about rm
shutdownback to summary
public static void shutdown()

Shutdown JGit and release resources it holds like NLS and thread pools

Since
5.8
stashApplyback to summary
public StashApplyCommand stashApply()

Returs a command object used to apply a stashed commit

Returns:StashApplyCommand

a org.eclipse.jgit.api.StashApplyCommand

Since
2.0
stashCreateback to summary
public StashCreateCommand stashCreate()

Return a command object used to create a stashed commit

Returns:StashCreateCommand

a org.eclipse.jgit.api.StashCreateCommand

Since
2.0
stashDropback to summary
public StashDropCommand stashDrop()

Return a command object used to drop a stashed commit

Returns:StashDropCommand

a org.eclipse.jgit.api.StashDropCommand

Since
2.0
stashListback to summary
public StashListCommand stashList()

Return a command object used to list stashed commits

Returns:StashListCommand

a org.eclipse.jgit.api.StashListCommand

statusback to summary
public StatusCommand status()

Return a command object to execute a status command

Returns:StatusCommand

a org.eclipse.jgit.api.StatusCommand used to collect all optional parameters and to finally execute the status command

See Also
Git documentation about status
submoduleAddback to summary
public SubmoduleAddCommand submoduleAdd()

Return a command object to execute a submodule add command

Returns:SubmoduleAddCommand

a org.eclipse.jgit.api.SubmoduleAddCommand used to add a new submodule to a parent repository

submoduleDeinitback to summary
public SubmoduleDeinitCommand submoduleDeinit()

Returns a command object to execute a submodule deinit command

Returns:SubmoduleDeinitCommand

a org.eclipse.jgit.api.SubmoduleDeinitCommand used to remove a submodule's working tree manifestation

Since
4.10
submoduleInitback to summary
public SubmoduleInitCommand submoduleInit()

Return a command object to execute a submodule init command

Returns:SubmoduleInitCommand

a org.eclipse.jgit.api.SubmoduleInitCommand used to initialize the repository's config with settings from the .gitmodules file in the working tree

submoduleStatusback to summary
public SubmoduleStatusCommand submoduleStatus()

Returns a command object to execute a submodule status command

Returns:SubmoduleStatusCommand

a org.eclipse.jgit.api.SubmoduleStatusCommand used to report the status of a repository's configured submodules

submoduleSyncback to summary
public SubmoduleSyncCommand submoduleSync()

Return a command object to execute a submodule sync command

Returns:SubmoduleSyncCommand

a org.eclipse.jgit.api.SubmoduleSyncCommand used to update the URL of a submodule from the parent repository's .gitmodules file

submoduleUpdateback to summary
public SubmoduleUpdateCommand submoduleUpdate()

Return a command object to execute a submodule update command

Returns:SubmoduleUpdateCommand

a org.eclipse.jgit.api.SubmoduleUpdateCommand used to update the submodules in a repository to the configured revision

tagback to summary
public TagCommand tag()

Return a command object to execute a Tag command

Returns:TagCommand

a org.eclipse.jgit.api.TagCommand used to collect all optional parameters and to finally execute the Tag command

See Also
Git documentation about Tag
tagDeleteback to summary
public DeleteTagCommand tagDelete()

Return a command object used to delete tags

Returns:DeleteTagCommand

a org.eclipse.jgit.api.DeleteTagCommand

tagListback to summary
public ListTagCommand tagList()

Return a command object used to list tags

Returns:ListTagCommand

a org.eclipse.jgit.api.ListTagCommand

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
verifySignatureback to summary
public VerifySignatureCommand verifySignature()

Return a command to verify signatures of tags or commits.

Returns:VerifySignatureCommand

a VerifySignatureCommand

Since
5.11
wrapback to summary
public static Git wrap(Repository repo)

Wrap repository

Parameters
repo:Repository

the git repository this class is interacting with; null is not allowed.

Returns:Git

a org.eclipse.jgit.api.Git object for the existing git repository. The caller is responsible for closing the repository; close() on this instance does not close the repo.