如何在 FileMerge 中进行三向合并?

发布于 2024-09-10 16:19:15 字数 204 浏览 7 评论 0原文

我看到指定三个文件(左文件、右文件和祖先文件)的选项,但似乎不可能实际显示祖先文件。

在此处输入图像描述

底部窗格显示合并的结果。我宁愿看看原始内容是什么,这样我就可以了解冲突左右双方的背景。这可能吗? FileMerge 的帮助文档很糟糕。

I see the option for specifying three files (left, right, and ancestor), but it doesn't seem to be possible to actually display the ancestor.

enter image description here

The bottom pane shows the result of the merge. I'd rather see what the original content was, so I could understand the context for the left and right sides of the conflict. Is this possible? FileMerge has awful help documentation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

孤独患者 2024-09-17 16:19:15

看起来在 2.5 版本中他们终于添加了这个功能。 “祖先”现在实际上意味着“祖先”,并且有一个单独的“合并”选项

从命令行您可以执行如下操作:

$ opendiff mine theirs --ancestor base

其中“我的”是我的文件版本,“他们的”是我正在尝试的版本合并,“base”是“我的”和“他们的”的共同祖先。

此命令将打开文件合并并在底部显示祖先(在我的 2010 年示例中,合并是在其中)。

不幸的是,这是不可能的使用 --merge 选项和 --ancestor 选项,因此您无法同时查看三向合并并使用文件合并来解决冲突

。冲突,然后像往常一样在文本编辑器中编辑冲突标记(叹气......)

Looks like in version 2.5 they have finally added this feature. "Ancestor" now actually means "Ancestor" and there is a separate "merge" option

From the command line you can do something like this:

$ opendiff mine theirs --ancestor base

Where "mine" is my version of the file, "theirs" is the version I'm trying to merge with, and "base" is the common ancestor of "mine" and "theirs.

This command will open File Merge and show the ancestor at the bottom (where the merge is in my example from 2010).

Unfortunately, it's not possible to use the --merge option along with the --ancestor option. So you can't view a three-way merge AND use File Merge to resolve the conflicts at the same time.

I am starting to use File Merge for viewing and understanding the conflict, then editing the conflict markers in a text editor as usual. (sigh...)

云仙小弟 2024-09-17 16:19:15

据我所知,文件合并不可能做到这一点。

付费(但非常好)应用程序:http://www.deltopia.com/

开源:http://sourcegear.com/diffmerge/

To my knowledge, this is not possible with filemerge.

Paid (but very good) app: http://www.deltopia.com/

Open source: http://sourcegear.com/diffmerge/

日裸衫吸 2024-09-17 16:19:15

@梅哈斯:
这并不完全正确。以下是 FileMerge 帮助中有关新祖先选项的文档:

Sometimes, you need to compare two versions of a file that have been modified
independently. For example, say two people branch a file; that is, they make
copies of a file and modify it. In this case, specify an ancestor file, which
is the common ancestor of the modified files.

The ancestor file lets FileMerge choose when to take changes from the left
file or the right file. For example, say the left file and the right file
contain a different version of line 33. If line 33 in the ancestor matches
line 33 in the left file, you know the change happened after the two files
branched off, and FileMerge prefers the newer version of line 33 in the right
file. If line 33 is different among the three files, you know that the files’
editors edited the lines separately. FileMerge displays that difference with
a red border and asks you to choose with edit to use.

因此,祖先仍然不显示,但它可以帮助合并工具在默认情况下决定选择左侧或右侧时做出更明智的决定。

@mehaase:
That is not exactly correct. Here is the documentation on the new ancestor option from FileMerge Help:

Sometimes, you need to compare two versions of a file that have been modified
independently. For example, say two people branch a file; that is, they make
copies of a file and modify it. In this case, specify an ancestor file, which
is the common ancestor of the modified files.

The ancestor file lets FileMerge choose when to take changes from the left
file or the right file. For example, say the left file and the right file
contain a different version of line 33. If line 33 in the ancestor matches
line 33 in the left file, you know the change happened after the two files
branched off, and FileMerge prefers the newer version of line 33 in the right
file. If line 33 is different among the three files, you know that the files’
editors edited the lines separately. FileMerge displays that difference with
a red border and asks you to choose with edit to use.

So the ancestor is still not displayed, but it helps the merge tool to make a little more informed decisions when it decides to choose the left or right sides by default.

旧伤还要旧人安 2024-09-17 16:19:15

我意识到这个答案从技术上讲并没有回答如何使用 FileMerge 做到这一点的问题,但我使用 kdiff3 (适用于 Windows、Mac 和 *nix),它显示了基础/祖先,加上左右边,加上输出/结果,用于 3 路合并。 (http://kdiff3.sourceforge.net/

这不是一个漂亮的用户界面,但是(恕我直言)它是使用起来相当简单并且效果很好。而且它是开源的。 :-)

I realise this answer technically doesn't answer the question on how to do it with FileMerge, but I use kdiff3 (available for Windows, Mac and *nix) and it shows the base/ancestor, plus left and right, plus output/result, for a 3-way merge. (http://kdiff3.sourceforge.net/)

It's not a pretty user interface, but (IMHO) it's fairly simple to use and works well. And it's open source. :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文