When using git subtree
an entire new tree, including a new first commit, is created in the same repository in which it was created. This means that at that point the repository contains two completely independent trees inside it, with no common parent at all.
What would be a good way to move this new tree to its own repository?
One approach is to create an empty git repository, add it as a remote of the original repository and then push only the new subtree to it. That will move only the commits from the new subtree into the new repo.
# create new repository
> mkdir newRepo
> cd newRepo
> git init
# add remote in the original repo
> cd /path/to/originalRepo
> git remote add newRepo /path/to/newRepo
# push only new subtree
> git push newRepo <hash-of-subtree>:subtreeBranch