let upper
, left
, and right
be directories as in the following diagram.
upper
├── left
└── right
question
how do i best manage these with git as local git repositories such that
- each
upper
,left
andright
has a separate git repository, - histories from the repositories of
left
andright
can be somehow propagated to the repository ofupper
, - histories from the repository
upper
can be somehow propagated to the repositories ofleft
andright
,
both of the latter preferably being done without changing the corresponding work-trees upper
, left
, and right
?
example
for clarity, call the git repositories of upper
, left
and right
just upper.git
left.git
and right.git
respectively. (you can imagine them as bare repositories entirely outside the mentioned directory structure.) first
- i work on
left
and commit toleft.git
; then - i somehow propagate the history from
left.git
toupper.git
, so the latter knows about all the work i have done; then - i work on
upper
, sometimes working on files inright
, and commit toupper.git
; then - i somehow propagate the history from
upper.git
toright.git
, so the latter knows about all the work i have done on files inright
.
thoughts
initially i thought that i could realise this by using git subtree. but when i try to include the repository for left
in upper
using git subtree -P left add ⟨left.git⟩ master
, i - perhaps unsurprisingly - get:
fatal: prefix 'left' already exists.
i have searched similar questions on stackoverflow, regarding nested repositories, but i quite don’t see how they relate to my problem. i probably don’t understand git subtrees well enough and perhaps i’m a bit too simple-minded in general. i have not looked deeply into git submodules; it seems to me that they are meant for something else.