Skip to content

Instantly share code, notes, and snippets.

@TheDeveloper
Created April 17, 2013 14:18
Show Gist options
  • Save TheDeveloper/5404654 to your computer and use it in GitHub Desktop.
Save TheDeveloper/5404654 to your computer and use it in GitHub Desktop.
Usage: remove_submodule submodule_path Where submodule_path is the relative path to your submodule from the current directory. Must be run from the root of a git working copy
# Sweep a git submodule out of the working copy
remove_submodule() {
SMD_PATH=$1
if [ ! -d $SMD_PATH ]; then
echo "$SMD_PATH does not exist"
return 1
fi
git config -f .git/config --remove-section submodule.$SMD_PATH
git config -f .gitmodules --remove-section submodule.$SMD_PATH
git rm --cached $SMD_PATH
rm -rf $SMD_PATH
rm -rf .git/modules/$SMD_PATH
}
alias gsubrm='remove_submodule'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment