Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to SVN merge two branches where same folder added to both branches

I have two different branches. trunk and a personal branch. The same folder was added to both branches at separate times. Now I want to merge my changes back into trunk but the folder already exists. For example (Merge personalDevBranch => trunk)

ADDED rev 123 /trunk/foo/bar.cs

ADDED rev 120 /branches/personalDevBranch/foo/baz.cs

I am using TortoiseSVN and it picks up the conflict. But it will only allow me to keep the local directory. When I do this it doesn't pick up the file baz.cs which I would have assumed should be shown as a new file for addition.

like image 947
uriDium Avatar asked Nov 06 '13 07:11

uriDium


2 Answers

The SVN team recommend patching the file manually - in this case you should be able to select your version of the folder which would merge your baz.cs, but this will effectively delete bar.cs as you're overwriting the folder contents with your merge.

Tree conflicts are the biggest (possibly the only) problem with SVN merging. You'd think that your case (2 people adding the same folder) would be easy to merge, but its not always the case - especially with renamed files.

like image 72
gbjbaanb Avatar answered Oct 06 '22 03:10

gbjbaanb


I faced this problem some time ago. As far as I remember, I marked the conflict in TortoiseSVN as resolved and merged this part by hand. The lesson I learned is to avoid such situations as good as possible. So in your case, just copy baz.cs in your folder.

like image 23
Micha Avatar answered Oct 06 '22 02:10

Micha