Home / How To

Add a repository inside another repository (using subtrees)

git subtree add --prefix my-nested-repo 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.