Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-svn isn't committing to branches, only trunk [duplicate]

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.

like image 587
Erik Kastner Avatar asked Aug 23 '09 19:08

Erik Kastner


1 Answers

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
like image 137
davetron5000 Avatar answered Oct 20 '22 00:10

davetron5000