Reputation: 5415
I have an SVN repo with a layout like
project1/trunk
project1/branches
project1/tags
project2/trunk
project2/branches
project2/tags
etc.
For a number of reasons, I'd like a git-svn repo that allows me to work on any of these projects and fetch/dcommit from/to all of them at once. Is this kind of thing possible? I know I could just git-svn clone the whole thing without specifying branches, tags, and trunk, but then I'd lose a lot of the advantage of using git.
Upvotes: 14
Views: 6264
Reputation: 11
To get around the issue of checking out multiple projects simultaneously, git-new-workdir can be used to check out multiple working directories from the same git repository, see https://github.com/git/git/blob/master/contrib/workdir/git-new-workdir
Upvotes: 1
Reputation: 1121
This is how I did it. There may be simpler ways, though.
Select the first project with the standard layout you'd like to work on and git svn clone
it:
git svn clone --stdlayout http://sample.com/svn/repository-name/project-name repository-name
Go into the repository-name
directory and edit its .git/config
file. You could also do this with git-config
commands, but I find it easier in a text editor.
You'll see an [svn-remote "svn"]
section already defined for your first project. Rename the svn-remote
to something more unique than "svn"
, probably the same as your project name. E.g., [svn-remote "project-name"]
.
Make more [svn-remote "project-name"]
sections for each project, following the template of the first one. Give each one a unique name! You'll need to change the fetch
, branches
, and tags
settings to use the correct Subversion directory names for each project.
Once you're done, save your file and run git svn fetch --fetch-all
. The other projects will be fetched as remotes in your local repository.
To switch your master
between projects, do a git reset --hard other-project-name/trunk
, just like if you were switching to work on any other remote Subversion branch.
Upvotes: 11