在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文件来工作。

其他回答

你可以配置你自己的合并工具来使用“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 你所期望的所有差异功能(差异,合并,文件夹差异)。 命令行接口。 可用的键盘快捷键。

我已经尝试了这里提到的很多工具,但没有一个是我想要的。

就我个人而言,我发现Atom是可视化差异和解决冲突/合并的好工具。

至于合并,它没有三个视图,但它都合并成一个彩色高亮每个版本。您可以直接编辑代码,也可以使用按钮来使用您想要的任何版本的代码片段。

我甚至不再把它用作编辑器或IDE,只是用来处理git。干净的UI和非常直接,加上它是高度可定制的。

You can start it from the command line and pass in a single file you want to open to, or add your project folder (git repo). I would also recommend project-manager as a very convenient way to navigate between projects without filling up your tree view. The only problem I've had is refreshing -- when working with large repositories atom can be slow to update changes you make outside of it. I just always close it when I'm finished, and then reopen when I want to view my changes/commit again. You can also reload the window with ctrl+shift+f5, which only takes a second.

当然是免费的。

Araxis合并http://www.araxis.com/merge 我在Mac OS X上使用它,但我在windows上使用过它……它不是免费的……但它有一些不错的功能……不过在Windows上更好。

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

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

First可以被调用:

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

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