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

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

我的操作系统是Ubuntu。


当前回答

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

其他回答

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

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

所以对于git合并,你可以尝试:

DiffMerge可以直观地比较和合并Windows、OS X和Linux上的文件。 Meld,是一个视觉差异和合并工具。 KDiff3,一个diff和合并程序),比较或合并2或3个文本输入文件/dirs。 opendiff (macOS上的Xcode工具的一部分),一个命令行实用程序,从终端启动FileMerge应用程序,以图形化的方式比较文件或目录,包括合并。

我使用不同的工具进行合并和比较:

git config --global diff.tool diffuse
git config --global merge.tool kdiff3

First可以被调用:

git difftool [BRANCH] -- [FILE or DIR]

当你使用git mergetool时调用第二个。

如果你只是在寻找一个无与伦比的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