How to overlay a particular folder in one project into the same folder on other projects

116 Views Asked by At

I have a use case where projects A, B and C are all using a third party tool with an opinionated directory layout. Each project has some duplicated files as well as their own custom files within the same layout.

To allow code reuse I would like to put the duplicated files into a separate project D, but have these shared files still visible within the layout used within A, B and C. I have looked at ways of achieving this via union file systems, docker and package / programmatic means, but each of these option has unwanted limitations.

Currently I'm investigating using GIT to achieve this, and I'd like to hear some suggestions on how to do it.

Using D as an upstream repository is almost what I need, as it will merge the files from D into locations in A, B and C when a fetch and merge happens. Unfortunately, if some other file in D changes and it also in A, B or C, there will be a merge conflict. Does anyone have an idea how to essentially do a 'sparse checkout' from just the upstream but not the main repository? I've experimented with hacking the .git/config file to add this in to the remote 'upstream' section to no avail. Any other ideas to achieve the same thing?

0

There are 0 best solutions below