Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch the svn branch git dcommits to

I had master dcommit to (and rebase from) the Subversion trunk.

I created an intermediate Subversion branch tc, to merge changes from 2 different branches, using:

git branch master
git svn branch tc -m "Branch for merging"
git checkout -b tcl --track tc
git merge cat #Another branch, whose changes I merged here
git commit -m 'Merged changes from cat branch'
git svn dcommit

Since everything was fine, I wanted to promote this to the trunk. I followed doing:

git branch master
git merge tcl
git svn dcommit

Now, because master was merged from another branch that was pointing to a different Subversion branch, it tries to commit to the Subversion branch tc. I want it committed to the Subversion trunk.

Is there a git svn switch or something like that?

I know my workflow is not the optimal and any suggestions to improve it are welcome too.

like image 347
lprsd Avatar asked Jul 18 '11 07:07

lprsd


1 Answers

As mentioned in this question, using git merge in a repository with git-svn is not a good idea.

Instead, what you should have done to "merge" the changes into master is:

git checkout master
git format-patch --stdout master..tcl | git am
git svn dcommit

The problem with git merge in this case is that it also sets the git-svn URL for master to the SVN tc branch. The format-patch and am combination only takes the changes themselves.

like image 169
Daniel Hershcovich Avatar answered Sep 28 '22 07:09

Daniel Hershcovich