title: JGit: Push to specific branch
body: <p>I have two branches on github: master and development. 
  I want to push a newly created file to the development branch.</p>
  
  <pre><code>    String user = "user";
      String password = "password";
      String localPath = "local";
      String remotePath = "https://github.com/some/git.git";
      Git.cloneRepository().setBranch("refs/heads/development").setURI(remotePath).setDirectory(new File(localPath)).call();
      Git localGit = Git.open(new File(localPath));         
      localGit.checkout().setName("origin/development").setUpstreamMode(SetupUpstreamMode.TRACK).call();
  
      new File("local/test").createNewFile();
  
      localGit.add().addFilepattern(".").call();
      localGit.commit().setMessage("message").call();
      localGit.push().setCredentialsProvider(new UsernamePasswordCredentialsProvider(user, password)).call();
  </code></pre>
  
  <p>What I get is a </p>
  
  <pre><code>  TransportException: Nothing to push.
  </code></pre>
  
  <p>What's the problem there?</p>
  
  <p><strong>Update:</strong>
  I could make it work by removing the checkout command. As the clone already checks out the specified branch, which wasn't clear to me before. </p>