相关疑难解决方法(0)

使用JGit获得所有分支

如何使用JGit获取存储库中的所有分支?我们来看一个示例存储库.我们可以看到,它有5个分支.
在这里我找到了这个例子:

int c = 0;
List<Ref> call = new Git(repository).branchList().call();
for (Ref ref : call) {
    System.out.println("Branch: " + ref + " " + ref.getName() + " "
            + ref.getObjectId().getName());
    c++;
}
System.out.println("Number of branches: " + c);
Run Code Online (Sandbox Code Playgroud)

但我得到的只是:

Branch: Ref[refs/heads/master=d766675da9e6bf72f09f320a92b48fa529ffefdc] refs/heads/master d766675da9e6bf72f09f320a92b48fa529ffefdc
Number of branches: 1
Branch: master
Run Code Online (Sandbox Code Playgroud)

java git github jgit

9
推荐指数
2
解决办法
6543
查看次数

标签 统计

git ×1

github ×1

java ×1

jgit ×1