是否可以在 Mac 上使用 GUI 并排工具查看 git diffs?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21486481/
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
Is it possible to view git diffs using a GUI side-by-side tool on Mac?
提问by amphibient
I really hate visualizing diffs using the default UNIX diff
tool. Is it possible to do view git diffs using a GUI tool that will nicely display the local and remote side-by-side, similar how it is possible to set the mergetool
to be DiffMerge
and when you do
我真的很讨厌使用默认的 UNIXdiff
工具来可视化差异。是否可以使用 GUI 工具查看 git diffs,该工具可以很好地并排显示本地和远程,类似于如何设置mergetool
为DiffMerge
以及何时执行
git mergetool myfile.txt
it pops the DiffMerge GUI for easier visualization and merging? I am using OSX.
它会弹出 DiffMerge GUI 以便于可视化和合并吗?我正在使用 OSX。
回答by Haralan Dobrev
You could use opendiff
. It is a command line tool which opens the GUI of FileMerge.
你可以使用opendiff
. 它是一个命令行工具,可以打开FileMerge的 GUI 。
You could instruct Git to use it automatically for git-mergetool
with:
您可以指示 Git 自动将其用于git-mergetool
:
git config --global merge.tool opendiff
If you want it for git-difftool
as well:
如果你也想要它git-difftool
:
git config --global diff.tool opendiff
And you could also disable the prompting for every file with:
您还可以使用以下命令禁用每个文件的提示:
git config --global difftool.prompt false
For more details type: git help config
and search with /
for the different options.
有关更多详细信息,请键入:git help config
并搜索/
不同的选项。
P.S. If you don't have opendiff
installed you could install it together with the Developer Tools from XCode: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/opendiff.1.html
PS 如果您还没有opendiff
安装,您可以将它与来自 XCode 的开发人员工具一起安装:https: //developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/opendiff.1.html
UPDATE: In recent versions of XCode, FileMerge is now bundled with XCode. You cannot install FileMerge as a standalone program. opendiff
is still in its command-line utilities which are standalone.
更新:在最新版本的 XCode 中,FileMerge 现在与 XCode 捆绑在一起。您不能将 FileMerge 作为独立程序安装。opendiff
仍然在其独立的命令行实用程序中。
回答by Daniel Margol
P4Merge from Perforce is pretty good and the standalone P4Merge application is free. You can get it at http://www.perforce.com/product/components/perforce-visual-merge-and-diff-tools
Perforce 的 P4Merge 非常好,独立的 P4Merge 应用程序是免费的。您可以在http://www.perforce.com/product/components/perforce-visual-merge-and-diff-tools获得它
Also, if you are using SublimeText than http://www.sublimerge.com/is also a good tool.
此外,如果您使用 SublimeText,那么http://www.sublimerge.com/也是一个不错的工具。
回答by Reinderien
Even if you aren't using Python, having PyCharm installed is worth it for its great Git integration. It's a good general-purpose editor and has a good visual diff+merge tool. The merge tool includes a triple-pane interface with intuitive code block selection. The community edition is free and works on my installation of MacOS High Sierra.
即使您不使用 Python,安装 PyCharm 也是值得的,因为它具有出色的 Git 集成。它是一个很好的通用编辑器,并且有一个很好的视觉差异+合并工具。合并工具包括一个带有直观代码块选择的三面板界面。社区版是免费的,适用于我安装的 MacOS High Sierra。
回答by Phil Perry
If you have the two different files, WinMerge does a very nice side-by-side comparison. I don't know if it's available for non-Windows platforms. Also, some systems will let you choose your own comparison tool, while others are hard coded to something specific -- I don't know about your Git environment.
如果您有两个不同的文件,WinMerge 会进行非常好的并排比较。我不知道它是否适用于非 Windows 平台。此外,有些系统会让您选择自己的比较工具,而其他系统则硬编码为特定的东西——我不知道您的 Git 环境。