title: git rm -r --cached not removing submodule folder and contents
body: <p>Solution:  remove <code>--cached</code> from <code>git rm -r --cached submodule/name</code>.  <a href="https://github.com/byrongibson/scripts/blob/master/git-rm-submodule.sh" rel="nofollow noreferrer">Scripted</a> for reference.</p>
  
  <hr>
  
  <p>I'm trying to remove a git submodule based on <a href="https://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule">this SO answer</a>, but the submodule is not being removed.</p>
  
  <p>I add the submodule, commit the changes, then delete it using <code>git rm -r --cached $path/to/submodule</code> (minus the trailing / ), commit the changes, but the submodule is still there.</p>
  
  <p>I can use <code>rm -rf submodules/lift_sbt_24</code> to delete the folder and contents, but why isn't <code>git rm -r --cached</code> doing that?</p>
  
  <p>(deleting the relevant section from .gitmodules works fine, is no problem, hence not mentioned here)</p>
  
  <p>This is git 1.7.5.4 on Ubuntu 11.10, fwiw.  Complete example:</p>
  
  <pre><code>$&gt; git submodule add git@github.com:lift-stack/lift_24_sbt.git submodules/lift_24_sbt
  Adding submodule from repo git@github.com:lift-stack/lift_24_sbt.git as submodules/lift_24_sbt
  Cloning into submodules/lift_24_sbt...
  remote: Counting objects: 619, done.
  remote: Compressing objects: 100% (375/375), done.
  remote: Total 619 (delta 172), reused 593 (delta 147)
  Receiving objects: 100% (619/619), 1.74 MiB | 112 KiB/s, done.
  Resolving deltas: 100% (172/172), done.
  $&gt; git status
  # On branch master
  # Your branch is ahead of 'origin/master' by 1 commits.
  #
  # Changes to be committed:
  #   (use "git reset HEAD &lt;file&gt;..." to unstage)
  #
  #   modified:   .gitmodules
  #   new file:   submodules/lift_24_sbt
  #
  $&gt; git add -a
  $&gt; git commit 'added submodules/lift_24_sbt'
  [master 9894113] update
   2 files changed, 4 insertions(+), 0 deletions(-)
   create mode 160000 submodules/lift_24_sbt
  $&gt; git rm -r --cached submodules/lift_24_sbt
  rm 'submodules/lift_24_sbt'
  $&gt; git status
  # On branch master
  # Your branch is ahead of 'origin/master' by 1 commits.
  #
  # Changes to be committed:
  #   (use "git reset HEAD &lt;file&gt;..." to unstage)
  #
  #   deleted:    submodules/lift_24_sbt
  #
  # Untracked files:
  #   (use "git add &lt;file&gt;..." to include in what will be committed)
  #
  #   submodules/lift_24_sbt/
  $&gt; git add -a
  $&gt; git commit -m 'deleted submodules/lift_24_sbt'
  # On branch master
  # Your branch is ahead of 'origin/master' by 1 commits.
  #
  nothing to commit (working directory clean)
  $&gt; ls -al submodules/lift_24_sbt/
  total 1060
  drwxr-xr-x 5 kurtosis kurtosis    4096 2012-04-18 17:26 ./
  drwxrwxr-x 6 kurtosis kurtosis    4096 2012-04-18 17:26 ../
  drwxrwxr-x 8 kurtosis kurtosis    4096 2012-04-18 17:32 .git/
  drwxrwxr-x 2 kurtosis kurtosis    4096 2012-04-18 17:26 project/
  drwxrwxr-x 3 kurtosis kurtosis    4096 2012-04-18 17:26 src/
  -rw-rw-r-- 1 kurtosis kurtosis     931 2012-04-18 17:26 build.sbt
  -rw-rw-r-- 1 kurtosis kurtosis     463 2012-04-18 17:26 .gitignore
  -rw-rw-r-- 1 kurtosis kurtosis      91 2012-04-18 17:26 README.md
  -rwxrwxr-x 1 kurtosis kurtosis     110 2012-04-18 17:26 sbt*
  -rw-rw-r-- 1 kurtosis kurtosis     131 2012-04-18 17:26 sbt.bat
  -rw-rw-r-- 1 kurtosis kurtosis 1041753 2012-04-18 17:26 sbt-launch.jar
  $&gt; git --version
  git version 1.7.5.4
  </code></pre>