I’ve searched for this before, and I’m sure I’ll do that again (although the need is not that frequent), so here it goes. It is possible to move files from one git repository to another, preserving commit history. The following links provide a few examples of how to do this:
- Greg Bayer’s explanation
- StackOverflow discussion
- Another StackOverflow discussion
Basically, you need git filter-branch command, usually with the –subdirectory-filter parameter.
An example of where it is useful would be the extraction of some code from a project you have into a shared library or a simple plugin.