From: Oleg Broytman Date: Mon, 15 Apr 2024 13:04:46 +0000 (+0300) Subject: Feat(submodules/remove): Add option `-c` X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=b0cdb013fbb3adb2f49035e3d36ddb6e96b87253;p=git-scripts.git Feat(submodules/remove): Add option `-c` Run `git rm --cached submodule` to preserve submodule's tree. --- diff --git a/submodules/remove b/submodules/remove index 1db57c2..f9436ce 100755 --- a/submodules/remove +++ b/submodules/remove @@ -1,8 +1,12 @@ #! /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 @@ -21,7 +25,7 @@ if [ -z "$path" ]; then 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" &&