[英]JGit: How to get all commits of a branch? (Without changes to the working directory …)
[英]How to get all commits without downloading to local system with JGit?
我需要從遠程存儲庫獲取所有提交。
這就是我將存儲庫克隆到本地系統的方式,但是下載所有文件並不是一個好主意,因為它有很多。
git = Git.cloneRepository().setURI(repo).setDirectory(pathGit).call();
File pathRepo = new File(pathGit.getPath() + "/.git");
repository = FileRepositoryBuilder.create(pathRepo);
如何解決這個問題?
克隆存儲庫是訪問其歷史記錄的唯一方法。 如果克隆存儲庫所需的時間是一個問題,您可能希望將其緩存以供將來或共享訪問。
像GitHab GitHab這樣的Git Hosting服務可能有專門的REST API來獲取提交元數據。 但是,這些特定於相應的服務托管商。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.