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
3
votes
1 answer

Create orphan branch and rm -rf in JGit

I'm using JGit to create an orphan branch as outlined on this answer. What is the equivalent command rm .git/index; git clean -fdx in JGit? I'm able to create a new branch normally without the --orphan argument, but am unsure how to apply it as well…
svict4
  • 432
  • 8
  • 24
3
votes
0 answers

JGit Clone from HTTPS: cannot open git-upload-pack

I am trying to clone from a repository with JGit. `public class DevJgit { public static void main( String[] args ) throws IOException, IllegalStateException, GitAPIException { String name = "name"; String password =…
3
votes
0 answers

Sort commits topologically using jgit

I'm having a issue where commits are being displayed out of order. The reason is not important, I just need to retrieve the commits and display them correctly in a changelog. I have done some research and the best solution I can find is using jGits…
ciffieM
  • 41
  • 5
3
votes
0 answers

Getting parent branch in JGit

I'm working on a project where I create a bare repository from a remote one, and fetch only one branch. What I'm trying to find out now is the name of the parent branch (or more specifically, the commit on the parent branch where this branch was…
Alaa Nassef
  • 280
  • 2
  • 13
3
votes
1 answer

JGitFlow maven plugin release-start from custom branch

Is it possible to make a release from custom branch (not develop)? I tried to use startCommit command, but Maven JGitFlow plugin has been switched to the develop branch before release is started. Also, when I changed git configuration manually, it…
Ivan
  • 193
  • 3
  • 14
3
votes
1 answer

Ignore .gitattributes while doing a checkout

JGit does not support .gitattributes. There is a 5 year old bug on that topic. As a consequence, the ident macro isn't used by JGit ($Id expansion). If you checkout a branch with regular console git, which supports .gitattributes and ident, the…
Amedee Van Gasse
  • 7,280
  • 5
  • 55
  • 101
3
votes
0 answers

Why is JGit's add command very slow?

I have a code base counting about 2000 files. Working with JGit 4.3.1.201605051710-r on OS X El Captain 10.11. Calling jgit init takes almost no time. Calling jgit add . takes about 3sec. Even when calling it repeatedly, it takes 2.7sec. Using git…
Pavel Lobodinský
  • 1,028
  • 1
  • 12
  • 25
3
votes
1 answer

Short form of SHA-1 commit id

What is the JGit equivalent API for the following command git log --pretty=format:"%h - %an, %ar : %s" I want to get the short form of SHA-1 commit id and the status of the file for that particular commit.
3
votes
1 answer

What's the jgit equivalent for "git merge-base --fork-point branchA branchB"

What's the jgit equivalent codeo for "git merge-base --fork-point branchA branchB"? I tried the code below but I'm not getting the correct answer. I'm using this to hunt for branch origin. foreach.branch (git merge-base --fork-point mybranch…
Peter Kahn
  • 12,364
  • 20
  • 77
  • 135
3
votes
0 answers

Use jgit to do git fetch -p

I understood that git.fetch().setRemoveDeletedRefs(true).call() would do the equivalent of "git fetch -p" in my program, but when I run that line, it actually deletes my master and HEAD remote refs. Running "git fetch -p" on the CLI does not.…
SamWill
  • 43
  • 4
3
votes
1 answer

Jgit: how to show changed files in merge commit

I'd like to use jgit to get a list of files that were changed in a merge commit, similar to what git show --name-only does in git. There are plenty of examples on how to get changed files for normal commits with one parent, but they do not work for…
Peter Knego
  • 79,991
  • 11
  • 123
  • 154
3
votes
1 answer

Load content from Tag with JGit

In Java I'm trying to load the content pointed by a tag of my git repository. I would like to have temporary access to the version subfolders that correspond to that tag. I've tried to use the parseTag method of RevWalk, but I'm not sure if this is…
Nana89
  • 432
  • 4
  • 21
3
votes
1 answer

How to get repository statistics with JGit

The statistics I want to pull about a repository include those offered by the Github statistics API https://developer.github.com/v3/repos/statistics/ My question is, is this possible using the library JGit? From my research using stack over flow and…
user3904388
  • 103
  • 8
3
votes
0 answers

"Auth fail" error with maven-scm-provider-jgit during release:prepare

I am on a windows machine where git command line is not installed. I have installed GitExtensions and an EGit and this is sufficient for me (until now). Now I wanted to perform a maven release to BinTray, following this guide: Publishing releases…
Jmini
  • 9,189
  • 2
  • 55
  • 77
3
votes
2 answers

Use JGit to get the git commit count

With the git command-line, the way to get the git commit count is git rev-list HEAD --count How to do this with JGit?
paleozogt
  • 6,393
  • 11
  • 51
  • 94