Skip to content

Instantly share code, notes, and snippets.

@nek023
Created March 8, 2013 05:10
Show Gist options
  • Save nek023/5114338 to your computer and use it in GitHub Desktop.
Save nek023/5114338 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ]; then
echo "Error: Specify a path to the submodule directory" 1>&2
exit 1
fi
if [ ! "$(pwd)" = "$(git rev-parse --show-toplevel)" ]; then
echo 'Error: Run again after: cd "$(git rev-parse --show-toplevel)"' 1>&2
exit 1
fi
git config --remove-section submodule."$1" || exit 1
git config --file .gitmodules --remove-section submodule."$1" || exit 1
git rm --cached "$1" || exit 1
rm -rf "$1" || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment