I've asked this question myself for a thousand times now but I can't seem to find the correct answer.
I'd like to separate a part of reusable code from the actual project however both the project and the reusable code part need each other.
Let's give an example. I've setup a working CMS which has it's own git repository. I have a catalog module which also has it's own git repository. Now I'd like to integrate the catalog module into my CMS git repository. To do so I currently use copy/paste which results in the same code in two places. I now notice a bug in the module whilst I'm running the CMS git repo and adding a product.
Currently to fix this bug, I've to make changes at two places: The working git repository and the separate catalog module so the next projects will not have this anymore.
Most of the time things are getting lost in copy/pasting etc so I'd like to add the catalog repo to the cms repo through git as a 'submodule', I've read about it but don't seem to get my head around it. So every time I make a change to the cms repo which contains changes to the catalog module I should be able to commit these changes to the other git repository.
If I don't make sense here, please comment and I'll try to explain it better. This is however a problem for me, and probably for many others.