title: Submodule commited branch no longer available
body: <p>In a repo, a branch has a submodule (call it sub-repo) set to a particular commit. However, this commit no longer exists (merged into another commit). Now when I try to pull the repo branch I get this error:</p>
  
  <pre><code>git submodule update --init sub-repo
  fatal: reference is not a tree: xxxxx
  Unable to checkout 'xxxxx' in submodule path 'sub-repo'
  </code></pre>
  
  <p>I was able to solve the problem by manually pulling the submodule and then committing it</p>
  
  <pre><code>git checkout --branch valid-branch sub-repo
  git add sub-repo
  git commit
  </code></pre>
  
  <p>But I am not sure if this is the systematic way to do it. Any ideas?</p>