tj.git-extras/bin/git-delete-submodule

10 lines
349 B
Bash
Executable file

#!/bin/sh
test -z $1 && echo "submodule required" && exit 1
test ! -f .gitmodules && echo ".gitmodules file not found" && exit 2
test -z $(git config --file=.gitmodules submodule.$1.url) && echo "submodule not found" && exit 3
git config --remove-section submodule.$1
git config --file=.gitmodules --remove-section submodule.$1
git rm --cached $1