I'm working with an SVN repository that is laid out like this:
$SVN/[project]/trunk
$SVN/[project]/branches/[user]/[branch]
$SVN/[project]/tags/releases/[tag]
My .git/config looks like this:
[svn-remote "svn"]
url = $SVN
fetch = project/trunk:refs/remotes/trunk
branches = project/branches/*/*:refs/remotes/*
When I look at git branch -a, I see all the remote branches. Let's say I want to check one out, work on it, then commit the changes back. Here's is what I am trying to do:
git checkout -b comments erik/comments
.... work, commit locally ....
git svn dcommit
However, dcommit always pushes to $SVN/project/trunk. git svn info
always reports the URL as $SVN/project/trunk
I've tried using --track, I've tried reseting with --hard. I'm out of ideas here. I suspect it's my [svn-remote], but that's just a hunch.
Does the branch erik/comments
exist in SVN already?
I work as follows:
git svn fetch #update any newly created branches
git checkout davec/new-feature # on remote branch, git may warn you
git checkout -b new-feature davec/new-feature # assumes this exists in SVN
# hack
# commit
git svn dcommit
I realize that git checkout -b local remote
is a one-step version of what I do in two steps, however this seems to work.
Another option is to replace your config with your username, e.g.
branches = project/branches/erik/*:refs/remotes/*
And then
git checkout new-feature # remote branch
git checkout -b new-feature-branch # local
It looks like this did more-or-less what I'm looking for:
Cloning a Non-Standard Svn Repository with Git-Svn
I still have an issue with some changes not showing up, but that's for another day. Thanks everyone!
You could try svn2git, and git2svn, as they do take into account non-standard SVN layouts.
They do use the --tags
and --branches
parameters of git svn
, and even if you do not use the scripts I mentioned above, you can use those parameters to get the data in the right places in your svn repository.