Is it possible to view git diffs using a GUI side-by-side tool on Mac?

独自空忆成欢 提交于 2019-12-03 11:15:04

问题


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

git mergetool myfile.txt

it pops the DiffMerge GUI for easier visualization and merging? I am using OSX.


回答1:


You could use opendiff. It is a command line tool which opens the GUI of FileMerge.

You could instruct Git to use it automatically for git-mergetool with:

git config --global merge.tool opendiff

If you want it for git-difftool as well:

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.


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

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.




回答2:


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

Also, if you are using SublimeText than http://www.sublimerge.com/ is also a good tool.




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/21486481/is-it-possible-to-view-git-diffs-using-a-gui-side-by-side-tool-on-mac

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!