On the local machine, I have common scripts that are imported by several projects, for example:
/common/ .git/ scripts/ common1.py /projectA/ .git/ scripts/ A1.py (imports from common1.py) /projectB/ .git/ scripts/ B1.py (imports from common1.py)
Common scripts and projects are tracked in separate git repositories. This works great for my personal work, because I can clone all the necessary repositories. When creating a project that is publicly accessible via git, I can include shared files using subtrees or submodules (links to regular files are updated, obviously, on B1.py):
/projectB/ .git/ scripts/ common/ (subtree from common) common1.py B1.py
Now I would like to assemble a super project (goal):
/projectC/ .git/ scripts/ common1.py A1.py B1.py
With subtrees and submodules, I was able to achieve:
/projectC/ .git/ scripts/ common/ common1.py projectA_scripts/ (via subtree) A1.py common/ (via subtree w/in projectA) common1.py projectB_scripts/ (via subtree) B1.py common/ (via subtree w/in projectB) common1.py C1.py
However, this is pretty redundant, and propagating changes through the sub-x chain will be tedious. How can I achieve the target directory structure above while still being able to retrieve updates for projects and shared files? For what it's worth, I don't expect you to need to push the subtree / submodule changes upstream.
Bonus for cross-platform (Windows-UNIX) solutions that do not require independent configuration for both operating systems. Git is the preferred solution.
source share