0
我正在使用Github Kohsuke API在Github上的远程仓库上搜索内容。目前,我只能从我的默认主分支下拉内容。除主人之外,有没有办法将分支上的内容拉下来?这里是我有的代码片段,它目前只从我的主分支分支中抽取。谢谢你的帮助!使用分支的名称ref
如何使用Github API搜索特定分支上的内容
public class GitCompareTest {
public static void main(String[] args) throws IOException {
GitHub github = GitHub.connect();
GHRepository repo = github.getRepository(repo_name);
List<GHContent> articleContents = repo.getDirectoryContent(path);
for (GHContent content : articleContents) {
if (content.isDirectory()) {
PagedIterable<GHContent> childArticleContents = content.listDirectoryContent();
for (GHContent childArticleContent : childArticleContents) {
String childText = childArticleContent.getContent();
String.out.println(childText);
}
}
}
}
}