Question

I have a problem with a SVN branch. I made a checkout of it with git checkout -t -b stable svn/stable. Then I did a merge with git rebase master. After that I tried to commit the merge changes into the remote branch with git svn dcommit

But now it seems, that Git pushed the changes into the trunk instead of the branch :(

And git status tells me:

# On branch stable
# Your branch and 'svn/stable' have diverged,
# and have 218 and 52 different commit(s) each, respectively.
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
...

Does somebody know what I did wrong and how to do it right?

Was it helpful?

Solution

I recently hit the same error. The thing is that when you rebase to master, it first hard-resets current branch to master and then applies commits being merged to it. But your master branch is associated with svn/trunk and thus the newly reset branch becomes associated with it as well. So git-svn on dcommit thinks that the commits are "inserted" into svn/trunk when you push them.

The solution is to use git merge --no-ff instead of git rebase. Or to use merge facilities of Subversion itself.

OTHER TIPS

Now it works, I did it like this:

   git checkout master
   git svn rebase
   git checkout --track -b svn_stable svn/stable
   git merge --squash master
   git commit -m "Bring stable up-to-date with trunk" 
   git svn dcommit --dry-run
   git svn dcommit

The merge was much easier than rebase with conflict handling.

In this try I forgot to use --no-ff, this forces a commit for each merge, right?

Thanks for your help :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top