'How to make a submodule behave as. a submodule in git?

I have created 2 submodules in my project. But, these submodules seem to have the commit history of the entire project, not just for the submodule. When I push from the submodule to remote repository for submodule, the entire project's commits, and not just the submodule's commit gets pushed.

In other words, my submodules aren't behaving as submodules. How do I fix it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source