Move files and retain history from one repository to another
We checkout a branch that we will filter against. We specify the path(s) that we want.
git checkout -b filter-source
git filter-repo --path file1 --path file2 --refs refs/heads/filter-source --force
git checkout -b filter-target
git remote add repo-source ../source
git fetch repo-source
git branch branch-source remotes/repo-source/filter-source
git merge branch-source --allow-unrelated-histories