We have several projects in the works that share a majority of their code/config files. The framework we're using has certain directory and file dependencies that limit us to how much we can segregate common code. For example, between 'common', 'projectA', and 'projectB' we might have:
/projectA
- /shared_dir1
- common1
- fileA1
- fileA2
- /common_dir2
- common2
- /dir3
- fileA3
- common3
- fileA4
/projectB
- /shared_dir1
- common1
- fileB1
- /common_dir2
- common2
- /dir3
- fileB2
- fileB3
- common3
- fileB4
- fileB5
We currently manage this with 3 Git projects: 'common', 'projectA', and 'projectB', with common files separated out into 'common' and project specific files in their own projects. 'projectA' and 'projectB' have a .gitignore with entries for all common dirs and all common files under each shared dir. A script copies 'common' into the project you want to work in and development is done there. Once a change is done, another script copies all common dirs and common files back into 'common'. Changes to 'common' and to the project can then be seen via 'git status'.
This obviously comes with its headaches of copying back and forth between 'common', keeping .gitignore accurate, and switching branches within 'projectA' and 'projectB'. As we plan for 'projectC-F', though, this approach seems nice as we can avoid merging common changes to N projects.
Looking for advice on how to better maintain this type of structure. Submodules seem undoable given the lack of segregation, unless we did a large number of them. I've seen some promising alternatives using symlinks, but that also comes with it's issues. Any advice would be appreciated.