4

I have an SVN merge tree conflict that i can't figure out how to resolve and i'm hoping you guys(girls) can help out.

Here's the situation: i created a branch A from trunk to do some development. Then i created a branch B, from branch A. Both branches are evolving concurrently.

At some point i cherry-picked some revisions from branch B into trunk to get some features developed in branch B.

Now, i synced branch A with trunk:

~/branch_a$ svn merge ^/trunk
~/branch_a$ svn commit

No problems here. Next step is to sync B with A:

~/branch_b$ svn merge ^/trunk

Here i get some tree conflicts, in files/dirs that already existed in trunk before the merge but were changed in the cherry-picks i did earlier (don't know if it has anything to do with it, i'm just mentioning it):

  C some_dir/other_dir/some_file.php
  >   local add, incoming add upon merge
  C some_other_dir/some_sub_dir
  >   local add, incoming add upon merge

Essentially i want the versions of the files that are coming in from the merge and discard the current version. What's the best way to solve this?

Thanks in advance!

2 Answers 2

3

Here's a site where you can find a well explained answer to how to do a merge.

http://www.sepcot.com/blog/2007/04/SVN-Merge-Branch-Trunk

When you use the merge without -r parameter you are trying to merge the entire branch included those revisions that not correspond exclusively to the branch i. What it really does is : it takes from the revision where you created the repository to the revision where you are actually now, and that includes the revision where this branch didn't exists yet, provoking, potentially, a lot of tree merging conflict and conflicts in generals.

When you are merging a branch to the trunk in svn you must specify the revision from the branch you want to pick, starting at the point where you make the copy that create the branch to the head revision of the trunk.

2
  • Thanks for your reply. I did what it told in the guide you pointed out. I did things correctly (i think). My problem now is how to fix the conflicts i have merging trunk back into the feature branch. Commented Oct 21, 2013 at 8:50
  • Oh yes.. that part, resolving conflic, is a hard job that the developer has to do with his bare hands. Most happy to help, if you thing that the answer is the appropriate and it resolved your question, don't forget to mark it as a correct one ;)
    – Victor
    Commented Oct 21, 2013 at 13:45
2

use below command it will resolve your tree conflict

svn resolve --accept working -R <file name with path>
3
  • 1
    ...and discard the changes from the other branch.
    – ceklock
    Commented Jul 5, 2017 at 12:29
  • 4
    WARNING: don't just do this. With this you're just telling SVN "Hey I've solved it", but if you didn't actually take the necessary steps to solve it then it will obviously do the wrong thing.
    – MarioDS
    Commented Jul 13, 2017 at 12:43
  • 1
    This is the command I was looking for for years, thanks 1000 times. If you just want to bring the state of a branch into another branch (or trunk), this is the solution. At least in combination with the other hint at stackoverflow.com/a/2648969/2081279 Commented Sep 12, 2017 at 11:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.