如何使用Java在git中进行稀疏检出

3

我希望能够在GIT中执行稀疏检出,即从存储库中检出部分工作副本。请问如何通过Java代码实现此操作。谢谢。


1
请访问以下链接以了解如何在JGit中实现稀疏检出:http://stackoverflow.com/questions/14407461/how-do-i-implement-sparse-checkout-in-jgit - centic
2个回答

2

基于@rüdiger-herrmann的回答

String url = "https://github.com/renaud/solr_noLenghNormSimilarity";
String hash = "802558f58add3a1f5b33f04254194bd7cd59b27f";
String subPath = "src/org";
String dest = "myclone";

File localPath = new File(dest);

Git gitRepo = Git.cloneRepository().setURI(url).setDirectory(localPath).setNoCheckout(true).call();
gitRepo.checkout().setStartPoint(hash).addPath(subPath).call();
gitRepo.getRepository().close();

1

目前的JGit库(截至3.0.0版本)不支持稀疏检出。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接