title: Checkout a tag in headless state with JGit
body: <p>Attempting to use JGit to checkout an existing tag on an existing repository. Preferably left in a headless state. The command should be as simple as:</p>
  
  <pre><code>git checkout clever-tag-name
  </code></pre>
  
  <p>However, the JGit incantation:</p>
  
  <pre class="lang-java prettyprint-override"><code>String tagName = "clever-tag-name";
  Git.open(new File(repoPath)).checkout().setName(tagName).call();
  </code></pre>
  
  <p>Results in a series of checkout errors. This usage seems like it should be trivial. The command line version has no issues given my repo's current state. </p>
  
  <p>Here's an example of the checkout error I am referring to:</p>
  
  <pre><code>Exception in thread "main" org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with files: 
  .idea/copyright/profiles_settings.xml
  ...
  at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:416)
  at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:397)
  at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:261)
  ... 6 more
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>