Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] JGIT newbie question

On Tue, Jan 11, 2011 at 10:51, sundarbun <sundarbun@xxxxxxxxx> wrote:
> I am looking into using JGit from Java

JGit related questions are probably better directed to the
jgit-dev@xxxxxxxxxxx mailing list, as that is the list most of the
JGit contributors monitor and answer questions on.  The project is
hosted at http://www.eclipse.org/jgit/ so you may find more resources
there too, including the latest 0.10.1 release.

> to get some files from source control
> for an application that runs on AWS.
> We currently use SVNKit and it seems to work fine. We recently made the
> switch to git and I am having a hard time finding a sample that allows one
> to
> (a) init or create a ocal repo with my credentials and path to the tree that
> I am interested in...

Use the Git object in the org.eclipse.jgit.api package.  There is an
init method that can create a new repository at the given directory.

> (a) get a bunch of files from my remote repo

Try the checkout() method on the Git object.

> (b) commit any changes back in...

Try the commit() method on the Git object.

But if you want to avoid using the working directory, you'll need to
go through a much lower-level API, setting up your own DirCache, and
using an ObjectReader and ObjectInserter to interact with the
Repository class.  Doing this requires some knowledge of the basic Git
data model (commits, trees, blobs).

-- 
Shawn.


Back to the top