title: Git: moving submodules recursively (nested submodules)
body: <p>I have the following git structure</p>
  
  <pre><code>- git-repo a
  -- subdirectory 2015
  --- git-submodule b
  -- git-submodule c
  --- git-submodule d
  </code></pre>
  
  <p>I would like to move the git submodule c to the folder 2015. 
  I know of "dirty ways" to do this (that involve modifying .git/config and changing gitdir in several of the files in the .git/modules files)</p>
  
  <p>I recently read that git mv should be able to do this, i.e., running </p>
  
  <pre><code>git mv c 2015/
  </code></pre>
  
  <p>This works fine for repositories in which there is no nested submodule (d in my case). However, when I run this command on my directory, I'm getting errors like </p>
  
  <pre><code>fatal: Not a git repository: d/../../.git/modules/c/modules/d
  fatal: 'git status --porcelain' failed in submodule 2015/c
  </code></pre>
  
  <p>(note, this error occurs on a git status after executing the above mentioned move)</p>
  
  <p>Is anyone aware of a clean method to do this move (i.e., one that does not involve manually changing paths in .git/modules files)?     </p>
  
  <p><strong>Edit: (6/10/2015)</strong> </p>
  
  <p>My current best solution that does not involve modifications to any of the  git config files is (first make sure that all changes to d have been committed and pushed somewhere)</p>
  
  <pre><code>rm c/d -rf
  git mv c 2015
  cd 2015/c
  git submodule update
  </code></pre>
  
  <p><strong>Edit: (8/10/2015)</strong> </p>
  
  <p>An even  less intrusive workaround</p>
  
  <pre><code>git mv c 2015
  rm 2015/c/d/.git
  cd 2015/c
  git submodule update
  </code></pre>
  
  <p><strong>Edit: (21/9/2018)</strong></p>
  
  <p>Since git version 2.19. This has been fixed and <code>git mv</code> behaves as expected. </p>