Clone repoA to create a new repo. Then set the bit unchanged for everything except the subfolder:
git update-index --assume-unchanged * git update-index --no-assume-unchanged <subdirectory>
Note: the file / directory argument must NOT begin with .
or /
After that, you can delete everything except the subfolder. Due to the supposed-unchanged bit, git won't notice this. Now work as if it would be a regular repository. You can copy the modified files from the old repoB to this one.
Please note that clicking and pulling can create files that are not already in a subfolder. To avoid this, you can create a binding to delete everything except the subdirectory.
source share