Extract git subdirectory while keeping history WITH renames

I'm splitting a big source tree into two separate components and a shared submodule. In order to prepare for this split, I first moved the shared stuff into a single "common" directory, updated all the references, and made a commit. So far so good. Now I'd like to extract that directory into a submodule.

Normally I'd do this with

git filter-branch --subdirectory-filter

But in this case, all the interesting history happened outside that subdirectory, so the history gets lost.

I understand that it doesn't make sense to keep the full history, since that wouldn't be filtering out any data at all. But I'm not really going for the ability to go back in time and build, I just want to be able to look at the commits each file was a member of.

Is there a way to keep the filter-branch behavior while keeping the history of the individual files?

12
задан Russell Mull 9 March 2011 в 08:13
поделиться