tags:

views:

33

answers:

2

I have a file.txt in trunk and i created a branch based on the trunk called Branch. The file.txt contains the following as the content: a b c d

And In the branch, i modified the file.txt to be

a
c
d
e

So after I merged the branch back to the truck, then file.txt becomes this: (I believe I did several merge on this file. Do I need to recreate a branch every time after I merge from the branch to trunk?)

a
b
c
d
e

Well, this is something what I don't expect, because I make changes to this file and I want the exact copy of the file merged into trunk.

So is my request not relating to merge? Or can merge do that?

And this is what I got confused. Is what I removed from the file will be considered as a difference and can it be merged to the trunk?

Thanks.

A: 

Merge tools are not magical. They'll do a best effort, but in many cases that won't be enough. You should never rely upon an automated merge.

That said, most merge tools should have caught the deletion of the line "b" and the addition of the line "e".

Randolpho
Also, git is not trying to be too smart about merging by design.
Tamás Szelei
A: 

Using git, I did this and ended up with 'acde'. However, if I use --strategy=ours, I end up with 'abcde'. So you can go either way depending on which merge strategy you choose. Subversion probably has a similar way to do this.

notfed