title: Generate patch of uncommitted changes for git repo and submodules
body: <p>I have a git repo <code>foo</code> that has several submodules in their own folders <code>bar</code> and <code>baz</code> (the actual repo is eclipse.platform.releng.aggregator). I need to generate patches for changes to those repos. </p>
  
  <p>I can generate a patch with <code>git --no-pager diff &gt; file.patch</code> which is fine for changes to <code>foo</code> but doesn't report changes in the <code>bar</code> or <code>baz</code>, the submodules.</p>
  
  <p>Using <code>git submodule --quiet foreach --recursive git --no-pager diff &gt; file</code> (cribbed from <a href="https://stackoverflow.com/a/13100667/1554850">this answer</a>) nearly works but the diffs don't include the names of the folders the subrepos live in.</p>
  
  <p>Presently I work round this by hacking the paths into the patches by hand but that only works for simple patches and the scripting solutions I can think of (e.g. getting the subrepo names from git, changing to the folders, generating the patches in folders) mean I can't use a simple <code>git apply</code> to reapply the patches later.</p>
  
  <p>Is there a way to get git to diff the subrepos directly rather than through foreach so the generated patches can be simply applied?</p>