Skip to content

Instantly share code, notes, and snippets.

@gotev
Last active May 10, 2019 05:03
Show Gist options
  • Save gotev/e7e5711458cee374315a5d3f67c4bbfc to your computer and use it in GitHub Desktop.
Save gotev/e7e5711458cee374315a5d3f67c4bbfc to your computer and use it in GitHub Desktop.
Remove git submodule
#!/bin/bash
NAME="$1"
if [ "x$NAME" == "x" ]; then
echo "please tell me the submodule name to remove"
exit -1
fi
TMP_NAME="${NAME}_tmp"
mv "$NAME" "$TMP_NAME"
git submodule deinit -f -- "$NAME"
rm -rf ".git/modules/$NAME"
git rm -f "$NAME"
git rm --cached "$NAME"
rm -rf "$TMP_NAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment