git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: JGIT newbie question

From
Shawn Pearce <spearce@spearce.org>
Date
Jan 11, 2011, 19:30 UTC
Message-ID
<AANLkTin=bZAgYeKHN2NUjYjZU5NBC_bs3bpCNNhijppq@mail.gmail.com>
In-Reply-To
<1294771910028-5911913.post@n2.nabble.com>
On Tue, Jan 11, 2011 at 10:51, sundarbun <sundarbun@yahoo.com> wrote:
> I am looking into using JGit from Java

JGit related questions are probably better directed to the jgit-dev@eclipse.org 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.

Show 7 quoted lines
> 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.
Previous: sundarbunNext: sundarbun
Message 2 of 3 in “JGIT newbie question”
  1. sundarbunJan 11, 2011
  2. Shawn PearceJan 11, 2011
  3. sundarbunJan 11, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.