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.