How do you remove a submodule properly?
Run git submodule deinit -f path, then git rm -f path, and delete the leftover .git/modules/path folder. Commit the change. Just deleting the folder leaves stale configuration behind.
Explain it simply
Removing a submodule is not like deleting a folder, since its registration lives in several places: .gitmodules, the index and .git/modules.
The tidy sequence: git submodule deinit -f libs/ui-kit unregisters it locally, git rm -f libs/ui-kit removes the folder and the .gitmodules entry, and rm -rf .git/modules/libs/ui-kit clears the stored repository. Commit the result. Skipping steps leads to errors such as 'already exists in the index' when adding it again.
Example
git submodule deinit -f libs/ui-kit
git rm -f libs/ui-kit
rm -rf .git/modules/libs/ui-kit
git commit -m "Remove ui-kit submodule"What to say in the interview
"I run git submodule deinit -f, then git rm -f on the path, remove the leftover directory in .git/modules and commit. Deleting the folder alone leaves stale registration in config and the index."