How to perform a 3-way visual diff on git?

蓝咒 提交于 2019-12-08 05:17:13

问题


I'd like to do a 3-way diff of a single file that exist in 2 different branches, that is, the last commit in each branch and also consider the common ancestor. I want to use an external tool that allows to do 3-way comparison. I was considering to use git difftool but as far as I could see it only allows comparing any 2 versions of a given file. I could use mergetool but that forces me to run git merge first so that, BASE, REMOTE and LOCAL variables are set. I don't want to run git merge. I just want to do a 3-way diff first to see the changes done on the file in both branches considering its common ancestor.

Is there an option to do what I need using difftool or mergetool? Thanks


回答1:


One solution is the visual diffuse which can directly operate on git revisions and supports n-way views.

For example, you can open a three-way diff between different branches for a file:

diffuse -r master -r HEAD -r upstream file.txt



来源:https://stackoverflow.com/questions/26301307/how-to-perform-a-3-way-visual-diff-on-git

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