title: JGit branch checkout Issue
body: <p>I am checking out a repository from github using the following code .</p>
  
  <pre><code>private String url = "https://github.com/organization/project.git";
      Git repo = Git.cloneRepository().setURI(url).setDirectory(directory).setCloneAllBranches(true).call();
      for (Ref b : repo.branchList().call()) {
          System.out.println("(standard): cloned branch " + b.getName());
      }
  </code></pre>
  
  <p>i am using the code</p>
  
  <pre><code>Git git = Git.open(checkout); //checkout is the folder with .git
  git.pull().call(); //succeeds
  </code></pre>
  
  <p>If i chekout a branch </p>
  
  <pre><code>Git git = Git.open(new File(checkout)); //checkout is the folder with .git
  System.out.println(git.getRepository().getFullBranch());
  CheckoutCommand checkout = git.checkout();
  Ref call = checkout.setName("kalees").call();
  </code></pre>
  
  <p>It throws org.eclipse.jgit.api.errors.RefNotFoundException: Ref kalees can not be resolved.</p>
  
  <p>What is the issue here, if i specify <strong>"master"</strong> instead of <strong>"kalees"</strong>, <strong>it works fine</strong>. what change should i do to checkout a specific branch?</p>
  
  <p><strong>if i use the code</strong> </p>
  
  <pre><code>git.checkout().setCreateBranch(true).setName("refs/remotes/origin/kalees");
  </code></pre>
  
  <p>It checkout the <strong>kalees</strong> branch. but when <strong>i do pull operation</strong> </p>
  
  <pre><code>git.pull().call(); 
  </code></pre>
  
  <p>it throws <strong>org.eclipse.jgit.api.errors.DetachedHeadException: HEAD is detached</strong>. What could be the , whether this is a checkout issue or pull issue ?</p>