How to merge several subversion remotes into one master branch
I want to track several subversion repositories in one git repository. I managed to get git svn to fetch all the subversion repositories into their own remote branches. So now
$ git branch -a
master
remotes/svn/Project1
remotes/svn/Project2
remotes/svn/Project3
Which seems good. Now I would like to merge all these branches into mas开发者_StackOverflow社区ter, but in subdirectories as they all contain similar named files. I tried to checkout one the branches, move the files into a subdirectory, commit and then merge into master. But that results in an error:
remote: error: refusing to update checked out branch: refs/heads/CPSP
remote: error: By default, updating the current branch in a non-bare repository
...
What would be the right way to archive this this? To be clear I would like to end up with a repository that looks like this:
Project1/
Project2/
Project3/
Just to make clear, these directories do not exist in the subversion repositories.
I plan to only track the subversion repositories, not commit to them (though that would be nice to have) Tnx!
I'm afraid by simple git operations you won't be able to achieve this.
If you think the git repository as a tree of contents, at any point of time, it can only have 1 snap shot. So if you map multiple svn repositories under different remote branches, you will never see them all at the same time.
If you really want to see the folders at the same type, below way might ease your pain a little bit:
- create a parent folder
- create a folder for project1
- go into project1 folder and clone the svn repository here
- do the same for all the projects you want to track
- go back to parent folder
- create a batch/script to go to every projects and pull the svn content
by above way, actually you have full access to svn, even commit. The downside is you can not use any git command directly from parent folder.
精彩评论