The most recent version of Git, 1.8.3, comes with a new and useful command for submodules:
git submodule deinit. Previously if you wanted to remove a submodule from a project you needed to manually take it out of the
.git/config file of the parent repository, and the
.gitmodules file. The new command does this for you. So for example:
$ git submodule deinit FooLib
This command tells Git to stop paying attention to the
FooLib submodule. That means commands like
git submodule sync will ignore it. This will not remove the submodule from disk, nor will create a commit removing the submodule. That is so you can reintegrate the submodule later if needed by using the command
git submodule init FooLib. If you want to delete a submodule and make that deletion part of the project history then you need to use
git rm -r FooLib instead.
git rm if you want to truly remove a submodule from a project. But if you just want to make Git shut-up and leave a submodule alone then
git submodule deinit is your new best friend.