Folder structure before (2 separate repositories):
XXX
|- .git
|- (project files)
YYY
|- .git
|- (project files)
Folder structure after:
YYY
|- .git <-- This now contains the change history from XXX
|- ZZZ <-- This was originally XXX
|- (project files)
|- (project files)
In YYY:
git remote add XXX_remote <path-or-url-to-XXX-repo>
git fetch XXX_remote
git merge -s ours --no-commit XXX_remote/master
git read-tree --prefix=ZZZ/ -u XXX_remote/master
git commit -m "Imported XXX as a subtree."
git remote rm XXX_remote
git push
Git amazes me daily. Thanks for the notes!