gpt4 book ai didi

git difftool 给目录比较?

转载 作者:IT王子 更新时间:2023-10-29 00:58:10 37 4
gpt4 key购买 nike

是否可以让 git difftool 命令打开一个目录,比较更改的文件和暂存/检查的文件?

理想情况下,如果有 2 个文件已更改,它们将是唯一显示的 2 个,但在目录比较中。

我读过有关让 git 并行提供所有文件差异的帖子,因此像 BeyondCompare 这样的工具拥有所有 the diffs in tabs ,但我对此并不满意!

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

最佳答案

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

这(比较目录而不是逐个文件)似乎很快可用:
参见 [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.

参见“ Patch difftool: teach difftool to handle directory diffs


原始答案(2010 年 1 月)

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?

基本上是:

您的 difftool 脚本将:

  • 创建 2 个临时目录
  • 将自己定义为 diff 工具
  • 调用 git diff
    • 然后调用自己来比较文件
    • 在该模式下,相同的脚本,对于每个文件,只将两个版本复制到两个临时目录中的diff
  • 然后继续在两个临时目录上调用 diff 工具(如 beyondCompare 或 WinMerge)

您在 this question 中有第一个示例.

关于git difftool 给目录比较?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2113889/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com