Questions tagged [jgit]

JGit is an EDL (new-style BSD) licensed, lightweight, pure Java library implementing the Git version control system.

JGit is an EDL (new-style BSD) licensed, lightweight, pure Java library implementing the version control system.

It is developed as part of the Eclipse Git Plugin .

JGit Supports:

  • Repository access routines
  • Network protocols
  • Core version control algorithms
  • Implementation of many porcelain commands
  • tasks for performing Git operations as part of automated builds
  • A Git daemon to provide a simple Git server
  • A jgit commandline tool for working with Git repositories

For details visit the Project page or the User Guide, there is also API Documentation available.

The community-provided jgit-cookbook provides ready-to-run snippets that show how things can be achieved when using JGit

956 questions
4
votes
1 answer

File diff against the last commit with JGit

I am trying to use JGit to get the differences of a file from the last commit to the most recent uncommitted changes. How can I do this with JGit? (using the command line would be the output of git diff HEAD) Following several discussions (link1,…
Tk421
  • 6,196
  • 6
  • 38
  • 47
4
votes
1 answer

How do I use JGit for Pulling or Fetching?

I had seen other similar questions but not a functional code that fetchs or pulls using JGit. Could anyone help me with a small pulling example or explanation that doesn't throws a JGIT Pull NoHeadException. Thanks in advance
4
votes
1 answer

JGit: How to squash commits

Any suggestions on how to use RebaseCommand, MergeCommand or any other command in JGit to squash commits? I cannot find many examples and the documentation is not very helpful. A simple example I want to squash the following…
modulitos
  • 14,737
  • 16
  • 67
  • 110
4
votes
1 answer

What do the egit merge modes mean?

I am doing a rebase with egit and there is a conflict egit popus up the following dialog box It is not clear to me what these two options. My questions are. What do these options really mean? Under what circumstances would I choose one option over…
ams
  • 60,316
  • 68
  • 200
  • 288
4
votes
1 answer

JGit bare commit / tree construction

I'm trying to commit a single blob directly to a repository using jgit. I know how to insert the blob and get its sha1, however I'm having difficulties constructing a tree for this scenario. I can't seem to figure out how to correctly use jgit's…
Jakob Odersky
  • 1,371
  • 11
  • 23
4
votes
1 answer

JGit: git submodule foreach command

I know the support for git submodules is limited in JGit, but still was wondering how can I achieve this: git submodule foreach git checkout and similar commands using JGit. Or is there any other better Java based API for Git?
yogytes
  • 53
  • 4
4
votes
2 answers

Commit with specific date using JGit Eclipse

I have investigated the possibilities to control Git from Java. What I have found is : Using Runtime.getRuntime().exec("git command") - to have Java execute commands with git Using JavaGit API (http://javagit.sourceforge.net/) or -Using Eclipse…
John Master
  • 309
  • 1
  • 4
  • 18
4
votes
1 answer

JGit : Rename/Copy detection using FollowFilter

So what i am trying to do is to detect rename/copy activities on a source code file since it is added to the repository. I am using following code - /** * * @param path source code file to retrieve complete history * @param start latest commit…
ajay.gour
  • 106
  • 1
  • 7
4
votes
1 answer

How to make a diff branches with JGit?

Use JGit. Need to know the difference in the branches. How to run a command JGit API: git diff --name-status ..origin
Mikhail
  • 53
  • 1
  • 8
4
votes
2 answers

Caused by: java.lang.ClassNotFoundException: com.jcraft.jsch.JSchException

The protocol between local repository and remote repository is HTTPS instead of ssh,does it still need lib of jsch,and if it's true, can you tell me how to handle in details,thanks so much~~
sophia2046234
  • 49
  • 2
  • 2
  • 4
4
votes
2 answers

Jenkins git-client: how to move to jgit on windows

Since the Jenkins git-client plugin moved to use jgit, there have been a lot of issues with configuration and all of the solutions I have seen involve just switching back to using the old git command line since most installations by now have most of…
user2120303
  • 255
  • 2
  • 4
  • 8
4
votes
0 answers

Jgit Shallow Clone (depth -2)

After a few changes in JGIT(BasePackFetchConnection class) we were able to send command (deepen 2) to the server for shallow clone. However when the server responds with a shallow commit Jgit is not able to handle this. What further commands have…
4
votes
2 answers

How to traverse Git repositories with JGit and draw a graph

I need to draw a graph out of a Git repository using JGit. I've been thinking about different ways to traverse the commits. I need to be able to draw a graph/graphs out of the branches/commits, and I also need to be able to do it within arbitrary…
Tower
  • 98,741
  • 129
  • 357
  • 507
4
votes
4 answers

Is there a JGit plumbing API?

I need to use git plumbing commands (such as those used in chapter 9 of the git book) like git hash-object, git write-tree, git commit-tree and all the rest. Is there a nice API to do these in JGit (I can't seem to find one) or how would you do…
Callum Rogers
  • 15,630
  • 17
  • 67
  • 90
4
votes
2 answers

How do I do "git show sha1:file" using JGit

I clone a repository as bare on my local disk using JGit. Now, I need to read the contents of a file at any given commit id (SHA1). How do I do this ?
Gaurav Shah
  • 51
  • 1
  • 5