I\'m not sure if this is possible but I\'d like to be able to have a single file and use it in two projects saved in git repostories. Such that, if I make a change in one projec
git submodule command can give you part of the functionality but it requires additional steps to keep the file in sync.
Along with git submodules, subtree merging is another approach to doing this. You can read a nice write-up in the Pro Git book (free online); there's also an official howto.
Avery Pennarun has written a specialized Git tool called git-subtree to handle git subtree merging more gracefully. You can read about it in his blog and you can find the code on github. From his post:
Note that, unlike git submodule, git subtree doesn't change the way people using your project need to work. As far as they're concerned, it's just one big project; nobody has to run (or install) git subtree unless they want to. It can just be the responsibility of a single person to extract the subproject history and upload it to the subproject repository, if you want.