I accidentally created a submodule on GitHub after forcing a commit. For some reason, I can't wipe my repository and start over so I need some way to delete the submodule so I can recommit. Is there any way I can delete the submodule through my terminal?
If it actually is a submodule, meaning your GitHub repo also have a .gitmodules files recording the associated path of that submodule, see my answer here:
1. git submodule deinit -f -- a/submodule
2. rm -rf .git/modules/a/submodule
3. git rm -f a/submodule
Then commit and push.
But if it is a simple gitlink, displayed as a grayed folder on GitHub, as shown here, then just remove it locally and push:
git rm -f a/submodule
git commit -m "remove submodule gitlink"
git push
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With