The problem: I have files that are shared by more than one repository. Specifically, the TermiSoc constitution and security policy both contain a logo and LaTeX style, which should be identical.

The solution: remote branches.

This is probably really obvious to anyone who already knows Git, but I had trouble working it out from the available documentation, so I’ll record it for posterity. I was somewhat hampered by the fact that my previous experience has been with Darcs, where you can pull from any repository to any repository, and expect everything to work just fine.

First, you’ll need to set up the repositories: one for the shared files, and however many to share these files amongst:

cd style
git init
git add *; git commit -m "import."

cd ../document
git init
git add *; git commit -m "import."

Then, add the remote branch:

git remote add style ../style
git fetch style
git branch style style/master
git merge style

Simple.

To update:

cd ../style
vi termisoc.sty
git commit -m "blah" termisoc.sty
cd ../document
git checkout style; git pull style
git checkout master; git merge style

This can probably be improved upon, but that’s the way that worked for me. You can probably also edit on the style branch in the document repository, and push from the style branch to the style repository, but it’s late and I couldn’t get it to work properly. I shall have to experiment at some point.