Created
May 17, 2023 14:17
-
-
Save barrientosvctor/5ac3dac3cc31654130784e2ec1fdc936 to your computer and use it in GitHub Desktop.
Remove any git submodule wtih this script.
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
#!/bin/bash | |
echo "WARNING: Make sure to run the script in root directory of your project." | |
echo "WARNING: Before to run this script, remember to previously remove git submodules in \`/.gitmodules/\` and \`/.git/config/\` files." | |
echo "" | |
read -p "Type the git submodule path that you will remove in your project: " path | |
# Stage the .gitmodules file | |
git add .gitmodules | |
# Notice the change | |
echo "'.gitmodules' has been staged" | |
# Untrack the git submodule in git project | |
git rm --cached $path | |
echo "'$path' untracked" | |
# Remove the git submodule in .git folder | |
rm -rf .git/modules/$path | |
# Remove the git submodule folder in the project | |
rm -rf $path | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment