Sunday, October 25, 2015

GIT: First steps with JGit

If you need a Java API for GIT, forget about JavaGit (it's just a wrapper around GIT CLI) and EGit - which internally uses JGit.

http://eclipse.org/jgit/

Useful snippets here https://github.com/centic9/jgit-cookbook

Download the library JAR here org.eclipse.jgit.jar, or if using maven consider using the dependency:
<dependency>
  <groupId>org.eclipse.jgit</groupId>
  <artifactId>org.eclipse.jgit</artifactId>
  <version>3.5.0.201409260305-r</version>
</dependency>


(the jar should end up in \org\eclipse\jgit\org.eclipse.jgit\3.5.0.201409260305-r inside your stink-maven repo)

Looking at the examples, you must have a LOCAL repository.... there doesn't seem to be a way to query a remote repository, like one hosted on Stash, without first doing a git clone.... I look rather for a REST-based API, this one https://bitbucket.org/atlassianlabs/stash-java-client seems quite promising.



No comments: