Search code examples
gitgit-submodulesgit-rm

git rm -r doesn't work in a submodule


Try to change submodule as described in git book

$ git rm -r vendor/html-minifier
$ git submodule add https://github.com/kangax/html-minifier.git vendor/html-minifier

But it fails with following

rm 'vendor/html-minifier'
fatal: git rm: 'vendor/html-minifier': Is a directory

Solution

  • From http://txt.binnyva.com/2008/07/remove-a-folder-from-git/

    git rm -r vendor/html-minifier/.
    

    Or maybe (from https://serverfault.com/questions/256421/cant-git-rm-a-directory)

    git rm --cached -r dirname