Update (3Jun2013) : An improved version the git subtree module is available, now with a config file to define your subtrees and imported projects. There is an updated blog post describing how to install and use it.
Did you ever want to merge an external git tree with yours, while keeping the commit history? Or do you want to create a new git repository from a folder in your project, keeping the history?
Then the git subtree module is what you need. It let's you import a complete git repo (with commit history) into your project, and add the files to a folder you specify.
For example :
$git subtree add --prefix=other_project \ git://github.com/your_tree/your_project.git master
imports the master branch of your git repository located in git://github.com/your_tree/your_project.git into the folder other_project.
If you make changes to this imported project and you want to push them back to the original project, you can use this :
$git subtree push --prefix=other_project \ git://github.com/your_tree/your_project.git master
BTW: the subtree module is not part of the core git package. So if you want to use it, you will have to install the module first.
Download the git subtree module and extract it, or clone it :
$git clone https://github.com/apenwarr/git-subtree
In the git-subtree directory, run
$chmod u+x install.sh
and as root :
This will copy the git subtree module to the git script folder. You can now use the git subtree module.