Run `git rm --cached submodule` to preserve submodule's tree.
#! /bin/sh
# See https://stackoverflow.com/q/1260748/7976758
+case "$1" in
+ -c|--cached) cached=--cached; shift ;;
+esac &&
+
if [ $# != 1 ]; then
- echo "Usage: $0 submodule_name" >&2
+ echo "Usage: $0 [-c|--cached] submodule_name" >&2
exit 1
fi
exit 1
fi
-git rm "$path" &&
+git rm $cached "$path" &&
rm -rf "`git rev-parse --git-dir`"/modules/"$name" &&
git config --remove-section submodule."$name" &&