Reference

Porcelain API

While JGit contains a lot of low level code to work with Git repositories, it also contains a higher level API that mimics some of the Git porcelain commands in the org.eclipse.jgit.api package.

Most users of JGit should start here.

AddCommand (git-add)

AddCommand allows you to add files to the index and has options available via its setter methods.

Here's a quick example of how to add a set of files to the index using the porcelain API.

<source lang="java"> Git git = new Git(db); AddCommand add = git.add(); add.addFilepattern("someDirectory").call(); </source>

CommitCommand (git-commit)

CommitCommand allows you to perform commits and has options available via its setter methods.

Here's a quick example of how to commit using the porcelain API.

<source lang="java"> Git git = new Git(db); CommitCommand commit = git.commit(); commit.setMessage("initial commit").call(); </source>

TagCommand (git-tag)

TagCommand supports a variety of tagging options through its setter methods.

Here's a quick example of how to tag a commit using the porcelain API.

<source lang="java"> Git git = new Git(db); RevCommit commit = git.commit().setMessage("initial commit").call(); RevTag tag = git.tag().setName("tag").call(); </source>

LogCommand (git-log)

LogCommand allows you to easily walk a commit graph.

Here's a quick example of how get some log messages.

<source lang="java"> Git git = new Git(db); LogCommand log = git.log().call(); </source>

MergeCommand (git-merge)

TODO