title: How to only pull latest commit in a git submodule
body: <p>Is there a way I can only pull the latest commit in a git submodule?  I was trying to put boost as a git submodule in some projects but since the boost repo with everything included is really heavyweight I wanted to only update the submodules to the latest commit and not pull all commits.  Is this possible?</p>
  
  <p>For example, when I do </p>
  
  <pre><code>git submodule update --init --recursive
  </code></pre>
  
  <p>All the boost submodules get pulled with all their commits.  Can I only ask the submodules to mirror the latest commit instead of pulling all changes?</p>
  
  <p><strong>Note</strong> Shallow clones with the <code>--depth</code> flag do not work because that only pulls the latest commit, and the latest commit has only the changes made in that commit, so the repository is not in the right state. </p>
  
  <p><strong>Note</strong> <code>git archive</code> (as suggested in an answer below) does not seem to work when I try the following sequence of commands</p>
  
  <pre><code>mkdir temp-git-test
  cd temp-git-test
  git init
  git submodule add --depth 1 https://github.com/boostorg/boost
  cd boost
  git archive --format=tar HEAD --output ../boost.tar.gz
  cd ..
  tar -xzvf boost.tar.gz
  </code></pre>
  
  <p>The output of the unzipped repo is the same as the submodule.  Am I doing something wrong?</p>