简体   繁体   中英

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. However, these are specific to the respective service hoster.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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