title: Git repo where each submodule is a branch of same repo. How to avoid double/triple... download with git clone --recursive?
body: <p>Suppose I have the following project tree:</p>
  
  <pre><code>src
  data
  doc
  </code></pre>
  
  <p>I'd like to keep all the folders in a Git repository, published to Gitlab. But I don't want to track <code>data</code> and <code>doc</code> together with <code>src</code>.</p>
  
  <p>So I use the following strategy:</p>
  
  <pre><code>git remote add origin ADDRESS
  git submodule add -b data ADDRESS data
  git submodule add -b doc ADDRESS doc
  </code></pre>
  
  <p>It actually works fine, except when I try to replicate the repository with:</p>
  
  <pre><code>git clone --recursive ADDRESS
  </code></pre>
  
  <p>all objects get transmitted 3 times: both the root and <code>data</code> and <code>doc</code> all contain:</p>
  
  <ul>
  <li>origin/master</li>
  <li>origin/data</li>
  <li>origin/doc</li>
  </ul>
  
  <p>Is there an easy way to avoid this? Just to clarify what I'd like:</p>
  
  <ul>
  <li>the master repository should only fetch <code>origin/master</code>, not the other two</li>
  <li>the data submodule should only fetch <code>origin/data</code>.</li>
  <li>the doc submodule should only fetch <code>origin/doc</code>.</li>
  </ul>
  
  <p>Would be easy to achieve with 3 separate repositories, but that's too cumbersome, since I apply this approach for multiple projects.</p>
  
  <h2>UPDATE</h2>
  
  <p><code>git worktree</code> from <a href="https://stackoverflow.com/a/43415914/1350992">this answer</a> allows me to achieve what I want manually.</p>
  
  <p>But now, instead of the automatic approach (which consumes 4x bandwidth):</p>
  
  <pre><code>git clone --recursive git@foo:foo/bar.git
  </code></pre>
  
  <p>I have to do:</p>
  
  <pre><code>git clone git@foo:foo/bar.git
  cd bar
  git worktree add data origin/data
  git worktree add src/notebooks origin/notebooks
  git worktree add doc origin/doc
  git worktree add reports origin/reports
  </code></pre>
  
  <p>I could automate this process with some scripts, since <code>.gitmodules</code> file already contains the complete info:</p>
  
  <pre><code>[submodule "data"]
      path = data
      url = git@foo:foo/bar.git
      branch = data
  [submodule "src/notebooks"]
      path = src/notebooks
      url = git@foo:foo/bar.git
      branch = notebooks
  [submodule "doc"]
      path = doc
      url = git@foo:foo/bar.git
      branch = doc
  [submodule "reports"]
      path = reports
      url = git@foo:foo/bar.git
      branch = reports
  </code></pre>
  
  <p>I wonder if there already is some standard git script or flag that handles this?</p>