Created
June 20, 2025 14:38
-
-
Save JeViCo/277401bd22d6f9db98eca5723eef1ecf to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # Exit on errors | |
| set -e | |
| # List all submodule paths | |
| submodules=$(git submodule status | awk '{print $2}') | |
| # Remove each submodule | |
| for submodule in $submodules; do | |
| echo "Removing '$submodule'" | |
| git submodule deinit -f -- "$submodule" | |
| rm -rf ".git/modules/$submodule" | |
| git rm -f "$submodule" | |
| done | |
| # Remove .gitmodules if it exists | |
| [ -f .gitmodules ] && git rm -f .gitmodules | |
| # Commit changes | |
| git commit -m "Remove all submodules" | |
| echo "All submodules removed successfully." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment