Created
December 23, 2012 07:20
-
-
Save seekshreyas/4362447 to your computer and use it in GitHub Desktop.
Delete Git Submodules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reference url : http://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule | |
# 1. Set path_to_submodule var (no trailing slash): | |
path_to_submodule=path/to/submodule | |
# 2. Delete the relevant line from the .gitmodules file: | |
git config -f .gitmodules --remove-section submodule.$path_to_submodule | |
# 3. Delete the relevant section from .git/config | |
git config -f .git/config --remove-section submodule.$path_to_submodule | |
# 4. Unstage and remove $path_to_submodule only from the index (to prevent losing information) | |
git rm --cached $path_to_submodule | |
# 5. Track changes made to .gitmodules | |
git add .gitmodules | |
# 6. Commit the superproject | |
git commit -m "Remove submodule submodule_name" | |
# 7. Delete the now untracked submodule files from git modules | |
rm -rf .git/modules/$path_to_submodule | |
# 8. Delete the now untracked submodule files | |
rm -rf $path_to_submodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment