What I want is similar to this question. However, I want the directory that is split into a separate repo to remain a subdirectory in that repo:
I have this:
If you wish split out just single directory as separate git repository
git-filter-branch has --subdirectory-filter
option and it is much simpler then previous mentioned solutions, just:
git filter-branch --subdirectory-filter foodir -- --all
Additionally it change path and place content of directory on top of new repo, not just filter and remove other content.