git submodule-rm
#!/bin/bash
# refs http://stackoverflow.com/a/1260982/667158
function submodule_rm() {
[ -z "$1" ] && return 1
local path="$1"
local dir=$(dirname ".git/modules/$path")
git config -f .git/config --remove-section "submodule.$path" &> /dev/null
git config -f .gitmodules --remove-section "submodule.$path" &> /dev/null
git rm --cached "$1"
if [ -d ".git/modules/$path" ]; then
rm -rf ".git/modules/$path"
while rmdir "$dir" &> /dev/null; do
dir=$(dirname "$dir")
done
fi
}
submodule_rm "$@"