4
如何確定Git存儲庫中最新的提交分支? 我想克隆只是最近更新的分支,而不是克隆所有分支,儘管它是否合併到主(默認分支)或不。在JGit中獲取最新提交的分支(名稱)詳細信息
LsRemoteCommand remoteCommand = Git.lsRemoteRepository();
Collection <Ref> refs = remoteCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider(userName, password))
.setHeads(true)
.setRemote(uri)
.call();
for (Ref ref : refs) {
System.out.println("Ref: " + ref.getName());
}
//cloning the repo
CloneCommand cloneCommand = Git.cloneRepository();
result = cloneCommand.setURI(uri.trim())
.setDirectory(localPath).setBranchesToClone(branchList)
.setBranch("refs/heads/branchName")
.setCredentialsProvider(new UsernamePasswordCredentialsProvider(userName,password)).call();
任何人都可以幫助我嗎?
感謝您的回覆!!!!!如果我得到任何路障,會發布...... – AshokDev