1. git remote add -f Bproject /path/to/B
2. git merge -s ours --no-commit --allow-unrelated-histories Bproject/master
3. git read-tree --prefix=dir-B/ -u Bproject/master
4. git commit -m "Merge B project as our subdirectory"
5. git pull -s subtree Bproject master
# The explanation
1. name the other project "Bproject", and fetch.
2. prepare for the later step to record the result as a merge.
3. read "master" branch of Bproject to the subdirectory "dir-B".
4. record the merge result.
5. pull in subsequent update from Bproject using "subtree" merge