Split a file with conflict markers

2019-04-28 19:07发布

问题:

I am looking for a tool that will split a file that has conflict markers into the two separate files. Is there anything out there that does this already?

回答1:

xxdiff can do that:

xxdiff --unmerge myfile.txt

it also works if the conflict markers result from a 3-way diff

xxdiff --unmerge3 myfile.txt


回答2:

The tool I work for (ECMerge) does that, primarily with the target of helping you to merge them visually of course. You could as well save the left/right/ancestor files with the built-in Javascript engine. ECMerge reads markers for most 'well-known' source code controls (CVS, git, mercurial, bazaar, SubVersion, Perforce, those compatible with the previously cited and of course its own markers!).



回答3:

Winmerge does that, they call it "Resolve conflict files". It only works on Windows though.



回答4:

As requested, my own solution to my question was to create the following Perl script.

http://github.com/quincy/Unmerge-Conflicts