在Git中查看和编辑合并的最佳工具是什么?我想要一个3路合并视图,“我的”,“他们的”和“祖先”在单独的面板,和第四个“输出”面板。

此外,调用该工具的指令也很好。(我仍然没有弄清楚如何以这样一种方式启动kdiff3,它不会给我一个错误。)

我的操作系统是Ubuntu。


当前回答

IntelliJ IDEA有一个复杂的合并冲突解决工具与Resolve魔棒,这大大简化了合并:

其他回答

你可以配置你自己的合并工具来使用“git mergetool”。

例子:

  git config --global merge.tool p4merge
  git config --global mergetool.p4merge.cmd p4merge '$BASE $LOCAL $REMOTE $MERGED'
  git config --global mergetool.p4merge.trustExitCode false

当你这样做的时候,你也可以把它设置为“git difftool”的difftool:

  git config --global diff.tool p4merge
  git config --global difftool.p4merge.cmd p4merge '$LOCAL $REMOTE'

注意,在Unix/Linux中,你不希望$BASE被你的shell解析为一个变量——它实际上应该出现在~/中。Gitconfig文件来工作。

如果你只是在寻找一个无与伦比的diff工具,非常不错:http://www.scootersoftware.com/moreinfo.php

您可以尝试P4Merge。

使用P4Merge可视化文件版本之间的差异。通过颜色编码解决由并行或并发开发引起的冲突。

特点包括:

Highlight and edit text file differences Choose to include or ignore line endings or white spaces Recognize line-ending conventions for Windows (CRLF), Mac (CR), and Unix (LF) Use command-line parameters and launch from non-Perforce applications Display line numbers when comparing and merging files Exclude files that are modified, unique, or unchanged Filter files by name or extension Organize modified assets in familiar file/folder hierarchy Compare JPEG, GIF, TIFF, BMP, and other file formats Extend using the Qt API Overlay images or display side-by-side Highlight differences on overlaid images

维姆迪夫

一旦你学会了vim(我认为你应该学会),vimdiff只是另一个需要学习的漂亮的小正交概念。要在vim中获得在线帮助:

:help vimdiff 

这个问题涵盖了如何使用它:我如何使用vimdiff来解决冲突?

如果您还停留在鼠标使用的黑暗时代,并且您要合并的文件不是很大,那么我建议您使用meld。

漫射是我的最爱,当然我有偏见。:-)它非常容易使用:

$ diffuse "mine" "output" "theirs"

Diffuse是一个用Python编写的小而简单的文本合并工具。使用Diffuse,您可以轻松地合并、编辑和检查对代码的更改。Diffuse是免费软件。