Merge one repo into another while retaining the history from the merged repo.

# Add the other repo as a remote
git remote add other-repo <url>
git fetch other-repo
 
# Merge it into a subdirectory, preserving history.
# 
# path/to/subdir - is relative to repo root.
# main - is the branch name in the other repo that we want to merge in.
git subtree add --prefix=path/to/subdir other-repo main