code: public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref ref,
                                          List<File> paths) throws JavaGitException, IOException {
          CheckUtilities.checkFileValidity(repositoryPath);
          if (ref != null && ref.getRefType() == RefType.HEAD) {
              throw new IllegalArgumentException("Invalid ref type passed as argument to checkout");
          }
          GitCheckoutParser parser = new GitCheckoutParser();
          List<String> command = buildCommand(options, ref, paths);
          return (GitCheckoutResponse) ProcessUtilities.runCommand(repositoryPath, command, parser);
      }
docs: Checks out a list of file from repository, with &lt;tree-ish&gt; options provided.