Run `git rm --cached submodule` to preserve submodule's tree.
{ git pull upstream master || git pull upstream main:master; } &&
git push origin master || exit 1
elif has_remote origin; then
{ git pull upstream master || git pull upstream main:master; } &&
git push origin master || exit 1
elif has_remote origin; then
- git pull origin master || exit 1
+ git pull origin master || git pull origin main:master || exit 1
#! /bin/sh
# See https://stackoverflow.com/q/1260748/7976758
#! /bin/sh
# See https://stackoverflow.com/q/1260748/7976758
+case "$1" in
+ -c|--cached) cached=--cached; shift ;;
+esac &&
+
- echo "Usage: $0 submodule_name" >&2
+ echo "Usage: $0 [-c|--cached] submodule_name" >&2
+git rm $cached "$path" &&
rm -rf "`git rev-parse --git-dir`"/modules/"$name" &&
rm -rf "`git rev-parse --git-dir`"/modules/"$name" &&
-exec git config --remove-section submodule."$name"
+git config --remove-section submodule."$name" &&
+
+if [ \! -s .gitmodules ]; then
+ git rm -f .gitmodules
+fi &&
+
+if [ -z $(ls -A "`git rev-parse --git-dir`/modules") ]; then
+ exec rmdir "`git rev-parse --git-dir`/modules"
+fi
+# See https://stackoverflow.com/a/77950870/7976758
set -e
# To the top-level directory of the current submodule
set -e
# To the top-level directory of the current submodule
# because it doesn't fix childrens' gitlinks.
# So the script runs recursion itself;
# it can be run with `git submodule foreach` without `--recursive`.
# because it doesn't fix childrens' gitlinks.
# So the script runs recursion itself;
# it can be run with `git submodule foreach` without `--recursive`.
+# See https://stackoverflow.com/a/77950870/7976758