如何在git上执行3路视觉差异? [英] How to perform a 3-way visual diff on git?

查看:156
本文介绍了如何在git上执行3路视觉差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对两个不同分支中存在的单个文件进行三方比较,即每个分支中的最后一个提交,并考虑共同的祖先。
我想使用允许进行3路比较的外部工具。
我正在考虑使用git difftool,但据我所见,它只允许比较给定文件的任何2个版本。
我可以使用mergetool,但这迫使我先运行git merge,以便设置BASE,REMOTE和LOCAL变量。我不想运行git merge。我只是想先做一个3-way比较,以查看两个分支考虑它的共同祖先在文件上所做的更改。



是否有选项可以做我需要使用difftool或mergetool?
感谢

解决方案

一个解决方案是视觉 diffuse 可以直接在git版本上运行,并支持n-way视图。

例如,您可以打开一个三不同分支之间的文件差异:

diffuse -r master -r HEAD -r上游file.txt


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

解决方案

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

这篇关于如何在git上执行3路视觉差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆