Git 最好的可视化合并工具是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/137102/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the best visual merge tool for Git?
提问by andy
What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "ancestor" in separate panels, and a fourth "output" panel.
在 Git 中查看和编辑合并的最佳工具是什么?我想获得一个三向合并视图,在单独的面板中包含“我的”、“他们的”和“祖先”,以及第四个“输出”面板。
Also, instructions for invoking said tool would be great. (I still haven't figure out how to start kdiff3 in such a way that it doesn't give me an error.)
此外,调用所述工具的说明会很棒。(我仍然没有弄清楚如何以不会给我错误的方式启动 kdiff3。)
My OS is Ubuntu.
我的操作系统是 Ubuntu。
采纳答案by user20805
Meldis a free, open-source, and cross-platform (UNIX/Linux, OSX, Windows) diff/merge tool.
Meld是一个免费、开源和跨平台(UNIX/Linux、OSX、Windows)的差异/合并工具。
Here's how to install it on:
安装方法如下:
- Ubuntu
- Mac
- Windows: "The recommended version of Meld for Windows is the most recent release, available as an MSI from https://meldmerge.org"
- Ubuntu
- 苹果电脑
- Windows:“推荐的 Meld for Windows 版本是最新版本,可从https://meldmerge.org以 MSI 的形式提供”
回答by Evgeny
You can configure your own merge tool to be used with "git mergetool
".
您可以配置自己的合并工具以与“ git mergetool
”一起使用。
Example:
例子:
git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd p4merge '$BASE $LOCAL $REMOTE $MERGED'
git config --global mergetool.p4merge.trustExitCode false
And while you are at it, you can also set it up as your difftool for "git difftool
":
当您使用它时,您还可以将其设置为“ git difftool
”的difftool :
git config --global diff.tool p4merge
git config --global difftool.p4merge.cmd p4merge '$LOCAL $REMOTE'
Note that in Unix/Linux you don't want the $BASE
to get parsed as a variable by your shell - it should actually appear in your ~/.gitconfig file for this to work.
请注意,在 Unix/Linux 中,您不希望$BASE
shell 将 解析为变量 - 它实际上应该出现在您的 ~/.gitconfig 文件中才能正常工作。
回答by Wernight
Beyond Compare 3, my favorite, has a mergefunctionality in the Pro edition. The good thing with its merge is that it let you see all 4 views: base, left, right, and merged result. It's somewhat less visual than P4Vbut way more than WinDiff. It integrates with many source controland works on Windows/Linux. It has many features like advanced rules, editions, manual alignment...
我最喜欢的Beyond Compare 3在专业版中具有合并功能。合并的好处是它可以让您看到所有 4 个视图:基本视图、左视图、右视图和合并结果。它的视觉效果比P4V少一些,但比 WinDiff 好得多。它与许多源代码控制集成并适用于 Windows/Linux。它具有许多功能,例如高级规则、版本、手动对齐...
The Perforce Visual Client(P4V)is a free tool that provides one of the most explicit interface for merging (see some screenshots). Works on all major platforms. My main disappointement with that tool is its kind of "read-only" interface. You cannot edit manually the files and you cannot manually align.
Perforce Visual Client( P4V)是一个免费工具,它提供了最明确的合并界面之一(请参阅一些屏幕截图)。适用于所有主要平台。我对该工具的主要失望在于它的“只读”界面。您不能手动编辑文件,也不能手动对齐。
PS: P4Merge is included in P4V. Perforce tries to make it a bit hard to get their tool without their client.
PS:P4Merge 包含在 P4V 中。Perforce 试图在没有客户的情况下让他们的工具变得有点困难。
SourceGear Diff/Mergemay be my second free tool choice. Check that merge screens-shotand you'll see it's has the 3 views at least.
SourceGear Diff/Merge可能是我的第二个免费工具选择。检查合并屏幕截图,您会看到它至少有 3 个视图。
Meldis a newer free tool that I'd prefer to SourceGear Diff/Merge: Now it's also working on most platforms (Windows/Linux/Mac) with the distinct advantage of natively supporting some source control like Git. So you can have some history diff on all files much simpler. The merge view (see screenshot) has only 3 panes, just like SourceGear Diff/Merge. This makes merging somewhat harder in complex cases.
Meld是一个较新的免费工具,我更喜欢SourceGear Diff/Merge:现在它也适用于大多数平台(Windows/Linux/Mac),具有本机支持某些源代码控制(如Git)的独特优势。所以你可以更简单地对所有文件进行一些历史差异。合并视图(见截图)只有 3 个窗格,就像SourceGear Diff/Merge 一样。这使得在复杂情况下合并有些困难。
PS: If one tool one day supports 5 views merging, this would really be awesome, because if you cherry-pick commits in Git you really have not one base but two. Two base, two changes, and one resulting merge.
PS:如果有一天一个工具支持5 个视图合并,这真的很棒,因为如果你在 Git 中挑选提交,你真的没有一个基础而是两个。两个基础,两个变化,一个结果合并。
回答by Wernight
I hear good things about kdiff3.
我听说 kdiff3 的好消息。
回答by Luke
My favorite visual merge tool is SourceGear DiffMerge
我最喜欢的可视化合并工具是SourceGear DiffMerge
- It is free.
- Cross-platform (Windows, OS X, and Linux).
- Clean visual UI
- All diff features you'd expect (Diff, Merge, Folder Diff).
- Command line interface.
- Usable keyboard shortcuts.
- 这是免费的。
- 跨平台(Windows、OS X 和 Linux)。
- 干净的视觉用户界面
- 您期望的所有差异功能(差异、合并、文件夹差异)。
- 命令行界面。
- 可用的键盘快捷键。
回答by Andrew Wagner
vimdiff
vimdiff
Once you have have learned vim (and IMHO you should), vimdiff is just one more beautiful little orthogonal concept to learn. To get online help in vim:
一旦你学会了 vim(恕我直言,你应该学会),vimdiff 只是一个更漂亮的小正交概念来学习。在 vim 中获取在线帮助:
:help vimdiff
This question covers how to use it: How do I use vimdiff to resolve a conflict?
这个问题涵盖了如何使用它:How do I use vimdiff to resolve a conflict?
If you're stuck in the dark ages of mouse usage, and the files you're merging aren't very large, I recommend meld.
如果您陷入使用鼠标的黑暗时代,并且您要合并的文件不是很大,我建议您使用 meld。
回答by Ron
You can try P4Merge.
你可以试试P4Merge。
Visualize the differences between file versions with P4Merge. Resolve conflicts that result from parallel or concurrent development via color coding.
使用 P4Merge 可视化文件版本之间的差异。通过颜色编码解决由并行或并行开发引起的冲突。
The features includes:
功能包括:
- 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
- 突出显示和编辑文本文件差异
- 选择包括或忽略行尾或空格
- 识别 Windows (CRLF)、Mac (CR) 和 Unix (LF) 的行结束约定
- 使用命令行参数并从非 Perforce 应用程序启动
- 比较和合并文件时显示行号
- 排除已修改、唯一或未更改的文件
- 按名称或扩展名过滤文件
- 在熟悉的文件/文件夹层次结构中组织修改后的资产
- 比较 JPEG、GIF、TIFF、BMP 和其他文件格式
- 使用 Qt API 扩展
- 叠加图像或并排显示
- 突出显示重叠图像上的差异
回答by niutech
IntelliJ IDEAhas a sophisticated merge conflict resolution toolwith the Resolve magic wand, which greatly simplifies merging:
IntelliJ IDEA有一个复杂的合并冲突解决工具,带有 Resolve 魔棒,极大地简化了合并:
回答by niutech
Diffuseis my favourite but of course I am biased. :-) It is very easy to use:
漫反射是我的最爱,但我当然有偏见。:-) 这是非常容易使用:
$ diffuse "mine" "output" "theirs"
Diffuse is a small and simple text merge tool written in Python. With Diffuse, you can easily merge, edit, and review changes to your code. Diffuse is free software.
Diffuse 是一个用 Python 编写的小而简单的文本合并工具。使用 Diffuse,您可以轻松合并、编辑和对代码的更改。Diffuse 是免费软件。
回答by Clintm
Araxis Merge http://www.araxis.com/mergeI'm using it on Mac OS X but I've used it on windows... it's not free... but it has some nice features... nicer on windows though.
Araxis Merge http://www.araxis.com/merge我在 Mac OS X 上使用它,但我在 Windows 上使用过它......它不是免费的......但它有一些不错的功能......更好窗户虽然。