non-graphical 3-way merge tool

試著忘記壹切 提交于 2019-12-10 18:16:42

问题


I currently use RCS' merge command to do 3-way merges, but one thing has always annoyed me about it. If I use the -A option, the same change made in both files shows up as a conflict:

<<<<<<< file1
file1 line 1
||||||| orig
orig line 1
=======
file2 line 1
>>>>>>> file2
orig line 2
<<<<<<< orig
=======
line added in both changes
>>>>>>> file2
orig line 3

If I use the default (-E) then those identical changes are not shown, but then the ouput only shows the two contributors, not the ancestor, something like this:

<<<<<<< file1
file1 line 1
=======
file2 line 1
>>>>>>> file2
orig line 2
line added in both changes
orig line 3

Is there some program that will essentially do the same behaviour as RCS merge but has some way of showing all three versions in conflicts while automatically merging identical changes?


回答1:


Looks like diff3 has some interesting options.

On ubuntu:

       -m  --merge
              Output merged file instead of ed script (default -A).

You asked for non-graphical, but vimdiff and gvimdiff can do 3 adjacent windows.




回答2:


KDiff3 is graphical, but it does have an "--auto" option that, when called from the command line, will perform the merge and show the GUI only if a conflict occurs. I know that means you still need a GUI, but kdiff3 can still be useful from the command line. I use it that way all the time (on Windows - not sure about other versions).

(I wanted to add this comment to the other KDiff3 post, but couldn't work out how to do it - sorry.)



来源:https://stackoverflow.com/questions/379593/non-graphical-3-way-merge-tool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!