Timothy Klim
Timothy Klim

Reputation: 1267

Shallow clone with JGIT

How I can do

git clone --depth 1 ...

with JGIT library?

Upvotes: 28

Views: 7452

Answers (2)

jonny
jonny

Reputation: 4663

According to the Release notes for version 6.5.0, this has been released on March 15, 2023.

You can now use any of

  • .setDepth(Integer)
  • .setShallowSince(Instant)
  • .setShallowSince(OffsetDateTime)

for example like so:

Git.cloneRepository().setDepth(1)

Upvotes: 6

Matthias Sohn
Matthias Sohn

Reputation: 329

You can't, JGit doesn't yet support shallow clones on the client side (it does on the server side, though).

Upvotes: 16

Related Questions