git subtree add --prefix my-nested-repo https://gitcheatsheet.org/example-git-repository.git main --squash
Creates a "clone" of the "main" branch of the remote repository into a local directory called "my-nested-repo", squashing the history of the "cloned" repository. Note: instead of specifying the url directly, you can use a remote name, if configured.