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

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

我的操作系统是Ubuntu。


当前回答

我最喜欢的可视化合并工具是SourceGear DiffMerge

它是免费的。 跨平台(Windows、OS X、Linux)。 干净的可视化UI 你所期望的所有差异功能(差异,合并,文件夹差异)。 命令行接口。 可用的键盘快捷键。

其他回答

您可以尝试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

你可以通过传递git mergetool -t=<tool>或——tool=<tool>来改变git mergetool使用的工具。要改变默认值(从vimdiff)使用git配置合并。工具> <工具。

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

你可以配置你自己的合并工具来使用“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文件来工作。

如果你使用visual studio, Team Explorer内置工具是一个很好的工具来解决git合并冲突。