javagit/src/main/java/edu/nyu/cs/javagit/api/commands/GitCheckout.java
public GitCheckoutResponse checkout(File repositoryPath, Ref ref, List<File> paths)
      throws JavaGitException, IOException {
    CheckUtilities.checkFileValidity(repositoryPath);
    if ( ref != null && ( ref.getRefType() != RefType.BRANCH && ref.getRefType() != RefType.SHA1) ) {
      throw new JavaGitException(100000, ExceptionMessageMap.getMessage("100000")
          + " RefType passed: " + ref.getRefType());
    }
    CheckUtilities.checkNullListArgument(paths, "List of files");
    IClient client = ClientManager.getInstance().getPreferredClient();
    IGitCheckout gitCheckout = client.getGitCheckoutInstance();
    return gitCheckout.checkout(repositoryPath, ref, paths);
  }
public GitCheckoutResponse checkout(File repositoryPath, Ref ref, List<File> paths)
      throws JavaGitException, IOException {
    CheckUtilities.checkFileValidity(repositoryPath);
    if ( ref != null && ( ref.getRefType() != RefType.BRANCH && ref.getRefType() != RefType.SHA1) ) {
      throw new JavaGitException(100000, ExceptionMessageMap.getMessage("100000")
          + " RefType passed: " + ref.getRefType());
    }
    CheckUtilities.checkNullListArgument(paths, "List of files");
    IClient client = ClientManager.getInstance().getPreferredClient();
    IGitCheckout gitCheckout = client.getGitCheckoutInstance();
    return gitCheckout.checkout(repositoryPath, ref, paths);
  }
Checks out files from the repository when a tree-ish object is given as the reference.

@param repositoryPath
Path to the Git repository.
@param ref
A branch, or sha1 object.
@param paths
<code>List</code> of file paths that are to be checked out.
@return <code>GitCheckoutResponse</code> object
@throws JavaGitException
Thrown if -
<li>the output for &lt;git-checkout&gt; command generated an error.</li>
<li>processBuilder not able to run the command.</li>
</ul>
@throws IOException
Thrown if -
<ul>
<li>paths given do not have proper permissions.</li>
<li>paths given do not exist at all.</li>
</ul>