简体   繁体   English

如何在不使用JGit下载到本地系统的情况下获取所有提交?

[英]How to get all commits without downloading to local system with JGit?

that I need to get all commits from a remote repository. 我需要从远程存储库获取所有提交。

This is how I clone a repository to a local system, but it's not a good idea to download all files because there is so much. 这就是我将存储库克隆到本地系统的方式,但是下载所有文件并不是一个好主意,因为它有很多。

git = Git.cloneRepository().setURI(repo).setDirectory(pathGit).call();
File pathRepo = new File(pathGit.getPath() + "/.git");
repository = FileRepositoryBuilder.create(pathRepo);

How to resolve this issue? 如何解决这个问题?

Cloning a repository is the only way to gain access to its history. 克隆存储库是访问其历史记录的唯一方法。 If the time that it takes to clone a repository is an issue, you may want to cache it for future or shared access. 如果克隆存储库所需的时间是一个问题,您可能希望将其缓存以供将来或共享访问。

Git Hosting services like GitLab of GitHub may have specialized REST APIs to obtain commit metadata. 像GitHab GitHab这样的Git Hosting服务可能有专门的REST API来获取提交元数据。 However, these are specific to the respective service hoster. 但是,这些特定于相应的服务托管商。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM