Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 329
stereobooster Avatar asked May 11 '12 08:05

stereobooster


People also ask

Why is submodule head detached?

After pulling changes from server, many times my submodule head gets detached from master branch. This is a common case when one does not use submodules too often or has just started with submodules.

How do I discard the modified content in git?

There are two Git commands a developer must use in order to discard all local changes in Git, remove all uncommited changes and revert their Git working tree back to the state it was in when the last commit took place. The commands to discard all local changes in Git are: git reset –hard. git clean -fxd.


1 Answers

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
like image 115
John Smith Avatar answered Sep 21 '22 16:09

John Smith