title: git - check out branch and submodules
body: <p>Which functions can I use to sync/init/update all submodules (local repo) to the version in a remote branch?</p>
  
  <p>The "Sync" (let's call it that, I don't mean git sync!) must also work when:</p>
  
  <ul>
  <li>A submodule has been added only to the remote branch</li>
  <li>Files within a submodule have been added/removed/modified locally. Tracked or untracked.</li>
  <li>Submodules are removed (optional)</li>
  </ul>
  
  <p>Essentially, I want the local repo to always be at exactly the same version as the remote branch. Without much fiddling whenever I change somthing in the submodules. So no manual ssh'ing to the server to init a new submodule, only for the deploy script to work...</p>
  
  <p>Can this be achieved without cloning (aka. transferring) the entire repository? I chose git to have a secure, fast way to deploy my sources. But the only option I can think of, is to do a complete <code>git clone --recursive</code> and check out submodules at their respective tags next. In which case, rsync would probably do a better job of syncing files.</p>