How to share files across git repositories?
I have several applications across sub domains on various servers Each application has its own git repository. Each application uses several shared files. Essentially, my repos overlap. How is this situation best handled with multiple editors of multiple projects?
I would try making all the overlapping parts git submodules.
As long as the multiple projects are pushing their changes to the submodule up to the shared location, yeah they can all makes changes to the shared resource. That said, if one of them needs theirs to be 'special' they'll have to branch the submodule.
https://git-scm.com/book/en/v2/Git-Tools-Submodules
This walks you through a super project with submodules, editing the submodule from within the super project and pushing it back up. It also shows the one danger which is silently overwriting changes if you run a git submodule update
and you had local unpushed changes on master branch.
Specifically, somewhere you've got a shared folder 'folder' - you'll need to remove this from all the git projects, but create a new git repo somewhere with the current contents as the initial commit. Then you'll git submodule <repo> folder; git submodule update
in all the projects which will now share it. They'll all be able to push changes up to the shared repo, and will be able to pull down each other's changes.