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:
Use git-filter-repo This is not part of git as of version 2.25. This requires Python3 (>=3.5) and git 2.22.0
mkdir new_repoA
mkdir new_repoB
git clone originalRepo newRepoA
git clone originalRepo newRepoB
pushd
cd new_repoA
git filter-repo --path foo/bar --path foo/baz
popd
cd new_repoB
git filter-repo --path foo/qux
For my repo that contained ~12000 commits git-filter-branch took more than 24 hours and git-filter-repo took less than a minute.