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?
Asked
Active
Viewed 3,741 times
1 Answers
7
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

VonC
- 1,262,500
- 529
- 4,410
- 5,250