开发者

About merging concern in subversion/git

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 tr开发者_StackOverflow社区unk?

Thanks.


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".


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜