title: Getting all branches with JGit
body: <p>How can I get all branches in a repository with JGit?
  Let's take an <a href="https://github.com/test-kitchen/test-kitchen" rel="noreferrer">example repository</a>. As we can see, it has 5 branches.<br>
  <a href="https://github.com/centic9/jgit-cookbook/blob/master/src/main/java/org/dstadler/jgit/porcelain/ListBranches.java" rel="noreferrer">Here</a> I found this example:</p>
  
  <pre><code>int c = 0;
  List&lt;Ref&gt; 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);
  </code></pre>
  
  <p>But all I get is this:</p>
  
  <pre><code>Branch: Ref[refs/heads/master=d766675da9e6bf72f09f320a92b48fa529ffefdc] refs/heads/master d766675da9e6bf72f09f320a92b48fa529ffefdc
  Number of branches: 1
  Branch: master
  </code></pre>