无法在Git的两个独立分支中区分文件 [英] Unable to diff files in two separate branches in Git

查看:224
本文介绍了无法在Git的两个独立分支中区分文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在branchA中有分支A和FileB中的FileA。

I have FileA in branchA and FileB in branchB.

问题是我在一次只能访问一个文件。
我希望能够通过FileMerge或meld比较文件,因为它们是我在Mac上找到的唯一diffTools。

The problem is that I can access only one file at time. I would like to be able to compare the files by FileMerge or meld, since they are the only diffTools whichI have found for Mac.

How你可以通过meld / FileMerge来区分这两个文件吗?

How can you diff by meld/FileMerge the two files?

[解决]:问题: FileMerge不允许标准输入

[Solved]: 1st developed Problem: FileMerge does not allow standard input


Masi:您可以使用 opendiff允许FileMerge 拥有来自标准输入的文件。所以接下来的问题是如何让git的diff工具使用opendiff。

Masi: You can use opendiff to allow FileMerge to have files from standard input. So the next problem is to find how to make git's diff tool to use opendiff.






2nd开发的问题:使Git的diff工具在Mac中使用opendiff


2nd developed Problem: to make Git's diff tool to use opendiff in Mac

推荐答案

git mergetool 合并,并在现代的git(意味着版本1.6.3和更高版本) git difftool 用于使用图形工具进行比较。当然你必须首先配置它们,但是它们会自动检测(当然有一些硬编码的偏好),如果我没有记错的话,opendiff支持是内置的。

You can use "git mergetool" for merging, and in modern git (meaning version 1.6.3 and later) "git difftool" for comparing using graphical tools. Of course you would have to configure them first, but they do some autodetection (with some hardcoded preference, of course), and if I remember correctly opendiff support is built in.

然后当然你可以像使用普通的git diff一样使用你的图形工具(opendiff / FileMerge),例如

And then of course you would be able to use your graphical tool (opendiff / FileMerge) as you would use ordinary "git diff", for example

prompt> git difftool somebranch:UNREADME otherbranch:README

这篇关于无法在Git的两个独立分支中区分文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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