Copy Main Branch from One Repo to a Directory Inside Another Repo

Is it possible to copy the Main branch of a Repo to a directory inside another Repo? Let’s say I have a Main branch in RepoA. I want to copy this main branch (along with history) from RepoA to a directory FolderA inside RepoB?

Yes, you can do it by making RepoA a submodule of RepoB — i.e. a repository hosted inside another one, where each one has a life of its own (think of it as a sort of symlink).

https://git-scm.com/book/en/v2/Git-Tools-Submodules