views:

30

answers:

2

Hi there,

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-git

Makes sense? Is it possible??

Thanks

+1  A: 

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?

Peter Tillemans
+1  A: 

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.

Tobu