使用OS X FileMerge / opendiff查看git差异,在目录视图中一次加载所有文件 [英] Using OS X FileMerge/opendiff to view git differences, loading all files at once in the directory view

查看:154
本文介绍了使用OS X FileMerge / opendiff查看git差异,在目录视图中一次加载所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用git来控制我们的项目。在OS X下开发,我们希望使用与开发工具一起分发的 FileMerge 应用程序来显示git生成的差异:

如果我们理解正确,可以配置它的调用通过 git difftool






遵循不同来源的建议,我们在我们的全局git配置文件中添加了这个:

  [diff] 
tool = opendiff

它适用于逐个文件差异。但是我们更喜欢在工具中一次加载目录差异,为此命令是 git difftool --dir-diff

当调用目录diff命令时,不同文件的列表在正确生成的情况下,但如果我们实际尝试打开一个文件,则双方都会显示错误文件不存在。显然,这是因为 opendiff 几乎立即终止,因此git会删除发生比较的临时文件夹。



这个答案,我们将这些行添加到我们的全局git配置文件中:



<$ p $ $已合并p> [difftool 了opendiff]
CMD =在/ usr /斌/了opendiff \ $ LOCAL\ \ $ REMOTE\ -merge \ \| cat

但它并未解决文件不存在问题(以及 仍然几乎立即返回)。



这个用例的正确配置是什么?解决方案

问题是Filemerge正在过滤掉 .git 目录,这是git存储目录中使用的目录输出 - dir-diff



在Filemerge中,转到首选项>过滤器并移除 .git 要忽略的文件,它应该可以工作。


We are version controlling our project using git. Developing under OS X, we'd like to use the FileMerge application distributed with the development tools to display git generated differences:
If we understood correctly, it is possible to configure its invocation through git difftool.


Following advices from different sources, we added this in our global git configuration file:

[diff]
    tool = opendiff

It works well for "file by file" diffs. But we prefer to have a directory difference loaded at once in the tool, for which the command is git difftool --dir-diff.

When invoking the directory diff command, the list of different files in correctly generated, but if we actually try to open one file, both sides show the error files does not exist. Apparently, this is because opendiff is terminating almost immediately, thus having git remove the temporary folders on which the comparison occurred.

Following this answer, we added those lines to our global git configuration file:

[difftool "opendiff"]
    cmd = /usr/bin/opendiff \"$LOCAL\" \"$REMOTE\" -merge \"$MERGED\" | cat

But it does not solve the file does not exist problem (and opendiff still returns almost immediately).

What would be the correct configuration for this use case ?

解决方案

The problem is Filemerge is filtering out the .git directory, which is where git is storing the directory used in the output of --dir-diff.

In Filemerge, go to Preferences > Filters and remove .git from Files to ignore and it should work.

这篇关于使用OS X FileMerge / opendiff查看git差异,在目录视图中一次加载所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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