How to import a svn repository underneath a git repository?
I have a svn repository that I migrated to git using the tool svn2git. Now I would like to push this git layout to a remote repository underneath an开发者_如何学编程 existing directory. But, I would like to keep the svn history (tags and branches). For instance:
Git remote repository layout:
git-repository/dirA
git-repository/dirB git-repository/dirC/svn-repository-migrated-to-gitMakes sense? Is it possible??
Thanks
Check out your outer git repository, add the imported git repository as a remote, and use git-subtree to make the imported repository a subtree of the other.
git clone git://path/to/remote/repo
cd repo
git remote add -f ../path/to/imported
git subtree add --prefix=subdir/ imported/master
git push
You should think the tag and branches requirement over, though. You are combining an outer repo having n branches with an inner repo having m branches. What are you going to do, create n×m branches?
If you want to preserve the branches of the imported repo, give it its own repository and not a subdirectory.
I do not think this is directly possible.
You can though use git submodules to "link" dirC to the repository just created.
Would that do?
精彩评论