code: public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref ref)
              throws JavaGitException, IOException {
          CheckUtilities.checkFileValidity(repositoryPath);
          checkRefAgainstRefType(ref, RefType.HEAD);
          List<String> command = buildCommand(options, ref);
          GitCheckoutParser parser = new GitCheckoutParser();
          GitCheckoutResponse response = (GitCheckoutResponse) ProcessUtilities.runCommand(repositoryPath,
                  command, parser);
          return response;
      }
docs: Git checkout with options and base branch information provided to &lt;git-checkout&gt; command.