I have multiple apps that use a shared set of files.
I would like to manage these files using subtrees. I have successfully set up one local clone by checking out the master files and adding the shared source as a subtree:
git subtree add --squash --prefix shared [email protected]:githubaccount/shared-repo-name.git master
This works locally but I can't find a way to make the origin aware of the subtree so that my colleagues don't have to manually add the subtree every time they clone the master repo.
I'm sure I'm missing something but it's not obvious from the scarce subtree documentation.
So it seems that although subtree add
looks like it pulls the subtree (and does indeed pull the files) it doesn't merge the subtree. so:
git subtree pull --squash --prefix shared [email protected]:githubaccount/shared-repo-name.git master
git push
Gets me what I expected (note that these are in addition to the subtree add
command in the initial question).