title: Read a file after cloning a repository with go-git
body: <p>I want to be able to do run-time <code>git</code> manipulations with <code>go</code>.</p>
  
  <p>I recently discovered the <a href="https://pkg.go.dev/gopkg.in/src-d/go-git.v4?tab=doc" rel="nofollow noreferrer"><code>go-git</code></a> package which comes in very handy to this end.</p>
  
  <p>I was also able to perform <code>pull</code> operations, more or less as follows:</p>
  
  <pre class="lang-golang prettyprint-override"><code>import {
    git "gopkg.in/src-d/go-git.v4"
  }
  
  repo, err := git.Clone(memory.NewStorage(), nil, &amp;git.CloneOptions{
      URL: "https://github.com/pkaramol/myrepo",
  })
  
  err := repo.Pull(&amp;git.PullOptions{
      RemoteName: "origin"
  })
  
  </code></pre>
  
  <p>My question is, assuming I am using in-memory checkout of the repo as above), how will I be able to read in (my <code>go</code> program) a file from the repository? i.e. assuming the file </p>
  
  <pre><code>https://github.com/pkaramol/myrepo/someConfig.yaml
  </code></pre>
  
  <p>Would it be preferable (in case I need <strong>just</strong> this particular file) to perform a git clone (still in mem) of <strong>only</strong> the particular file?</p>