Git Module

Provides functions to access and operate on git repositories through JGIT.

Method Overview

Method Description
add() Get repository status.
clone() Clone a git repository.
commit() Commit to a repository.
getStatus() Get repository status.
initRepository() Initialize a fresh repository.
openRepository() Open a local repository.
pull() Pull a repository.
push() Push a repository.

Methods

add

org.eclipse.jgit.dircache.DirCache add(Object repository, String filepattern)

Get repository status.

repository
repository instance or location (local) to get status from
filepattern
repository-relative path of file/directory to add (with / as separator)

add result

IOException
when resource cannot be accessed
NoFilepatternException
when filepattern is empty
GitAPIException
on a general error during git execution

clone

org.eclipse.jgit.api.Git clone(String remoteLocation, Object localLocation, [String user], [String pass], [String branch])

Clone a git repository.

remoteLocation
location to fetch repository from
localLocation
local path to be used
user
username for the remote repositoryOptional: defaults to <null>.
pass
password for the remote repositoryOptional: defaults to <null>.
branch
branch to checkout (null for all branches)Optional: defaults to <null>.

GIT API instance

InvalidRemoteException
when command was called with an invalid remote
TransportException
when transport operation failed
GitAPIException
on a general error during git execution

commit

org.eclipse.jgit.revwalk.RevCommit commit(Object repository, String message, [String author], [boolean amend])

Commit to a repository.

repository
repository instance or location (local) to pull
message
commit message
author
author to be used for the commit. Use format 'Real Name <email@address>'Optional: defaults to <null>.
amend
whether to amend the previous commitOptional: defaults to <false>.

commit result

IOException
the repository could not be accessed
GitAPIException
on a general error during git execution

getStatus

org.eclipse.jgit.api.Status getStatus(Object repository)

Get repository status.

repository
repository instance or location (local) to get status from

repository status

IOException
when resource cannot be accessed
GitAPIException
on a general error during git execution

initRepository

org.eclipse.jgit.api.Git initRepository(Object location, [boolean bare])

Initialize a fresh repository.

location
repository location
bare
true for bare repositoriesOptional: defaults to <false>.

GIT API instance

GitAPIException
on a general error during git execution

openRepository

org.eclipse.jgit.api.Git openRepository(Object location)

Open a local repository.

location
local repository root folder

GIT API instance

IOException
when resource cannot be accessed

pull

org.eclipse.jgit.api.PullResult pull(Object repository)

Pull a repository.

repository
repository instance or location (local) to pull

pull result

IOException
when resource cannot be accessed
GitAPIException
on a general error during git execution

push

Iterable<T> push(Object repository)

Push a repository.

repository
repository instance or location (local) to pull

push result

IOException
when resource cannot be accessed
GitAPIException
on a general error during git execution