Seph Reed
Seph Reed

Reputation: 10938

How can I disable submodules in git?

I'm trying to make a private mono-repo, with sub packages that have public gits. At no point do I have any intent of modifying the code outside of my mono-repo, so I have no need for submodules. In fact, they're the very thing I'm trying to avoid at all costs.

I don't want to delete the .gits for any of the packages in my mono-repo, and I don't want to do anything fancy.

How can I simply disable submodule functionality in git?

I don't ever want anything to be considered a submodule. Never have, and probably never will.

I've tried searching for some .submodule folder or something in the git. I found none. There appears to be no settings to get rid of these things.

I've found this link: un-submodule a git submodule

Unfortunately, these solutions all have to do with flattening submodules, and none of them cover a way to just disable the feature entirely.

Upvotes: 6

Views: 3034

Answers (1)

bk2204
bk2204

Reputation: 76489

Git doesn't have a feature to disable submodules. They're considered part of the core functionality and Git doesn't have options to disable core functionality like that. It's extremely unlikely that such a feature would be added.

If you don't want your subrepos to be accidentally be checked in as submodules, you can ignore them, in which case Git won't check them in. If they're already checked in, you can just run git rm --cached DIRECTORY for each submodule and then remove the .gitmodules file, then add them to .gitignore.

Upvotes: 2

Related Questions