git difftool给目录比较? [英] git difftool to give directory compare?

查看:546
本文介绍了git difftool给目录比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能得到git difftool命令来打开一个目录比较更改的文件和分段/检查文件?

所以理想情况下,如果2个文件有改变,他们将是唯一显示的2,但在一个目录比较。



我读过关于让git并行提供所有文件差异的文章,所以像BeyondCompare的所有标签中的差异,但我并不满意!



可以将已更改文件的副本从暂存/检入文件拖到临时文件夹中,然后打开。是唯一的选择吗?

解决方案

2012年6月更新(2年半后):

这样(比较目录而不是逐个文件)似乎很快就可以使用:

请参阅 [ANNOUNCE] Git 1.7.11.rc1


git difftool 了解了 - dir-diff 选项以生成外部diff工具,该工具可以在填充两个临时目录后每次比较两个目录层次结构,而不是每个文件对运行一次外部工具的实例。




请参阅 修补程序 difftool :teach difftool 处理目录差异






原始答案(2010年1月)


将已更改的文件从暂存/检入文件复制到临时文件夹中,然后将其打开。这是唯一的选择吗?


基本上可以:

您的difftool脚本会:


  • 创建2个临时目录

  • 将自己定义为diff工具

  • 调用git diff


    • 然后在该模式下调用它自己让文件区分
    • 相同的脚本,对于每个文件,只复制两个版本以在两个临时目录中比较


  • 然后继续并调用diff工具(比如beyondCompare或WinMerge)在两个临时目录中



您在这个问题


Is it possible to get the git difftool command to open a directory compare between the changed files and the staging/checked files?

So ideally, if 2 files have changed, they would be the only 2 shown, but within a directory compare.

I've read posts about getting git to give all file diffs in parallel, so tools like BeyondCompare has all the diffs in tabs, but im not happy with that!

One could pull a copy of the changed files from staging/checked in files into a temp folder, and then open that up. Is that the only option?

解决方案

Update June 2012 (2 and an half years later):

This (comparing directories instead of file-by-file) seems to be soon available:
See [ANNOUNCE] Git 1.7.11.rc1:

"git difftool" learned the "--dir-diff" option to spawn external diff tools that can compare two directory hierarchies at a time after populating two temporary directories, instead of running an instance of the external tool once per a file pair.

See "Patch difftool: teach difftool to handle directory diffs"


Original answer (January 2010)

One could pull a copy of the changed files from staging/checked in files into a temp folder, and then open that up. Is that the only option?

Basically yes:

You difftool script would:

  • create 2 temp directories
  • defines itself as a diff tool
  • call git diff
    • which then call itself for file to diff
    • in that mode, the same script, for each files, only copy the two version to diff in the two temp directories
  • then go on and call diff tools (like beyondCompare or WinMerge) on the two temp directories

You have one first example in this question.

这篇关于git difftool给目录比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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