【发布时间】:2012-11-09 11:12:53
【问题描述】:
我已经用我的 git 配置了 kDiff3。
我需要的是查看两个分支之间的目录差异。当我跑步时
git difftool <headbranch>
命令它一一打开所有文件。但这不是我想要的。
【问题讨论】:
我已经用我的 git 配置了 kDiff3。
我需要的是查看两个分支之间的目录差异。当我跑步时
git difftool <headbranch>
命令它一一打开所有文件。但这不是我想要的。
【问题讨论】:
git-difftool(1) 现在满足这个用例。只需使用 --dir-diff(或 -d)开关:
-d
--dir-diff
Copy the modified files to a temporary location and perform
a directory diff on them. This mode never prompts before
launching the diff tool.
例如:
git difftool -d --tool=kdiff3 10c25f0da62929cca0b559095a313679e4c9800e..980de1bbe1f42c327ed3c9d70ac2ff0f3c2ed4e1
另见https://www.kernel.org/pub/software/scm/git/docs/git-difftool.html
【讨论】:
--no-symlink,这样我在 kdiff3 中所做的任何更改都将应用当前签出的工作目录。
你可以使用
git diff --name-status <other-branch>
列出有差异的文件,状态为 A/M/D。
【讨论】:
我还没有发现使用 kdiff3 和标准 git 工具在目录比较模式下查看两个分支之间的目录差异的可能性。
使用标准工具可以做什么(如果我错了,请纠正我:)是使用 difftool 逐个文件比较,并在控制台中使用概述:
git diff --name-status <other-branch>
但我找到了Comprehensive Graphical Git Diff Viewer Script,它为我完成了所需的工作 - 比较 kdiff3 中的整个目录。
该工具只是一个 shell 脚本,它在 /tmp 文件夹中创建要比较的分支快照并对其运行 kdiff3 文件夹比较。
签出脚本here
【讨论】:
假设我们有两个分支 master 和 base 为了查看这些分支之间的区别,只需执行:
git difftool -d base:src/ master:src/
然后你的预设差异工具应该开始了,在我的例子中是 kdiff3。
或者您也可以使用--tool 选项来启动另一个:
例如使用 vimdiff
git difftool -d --tool=vimdiff base:src/ master:src/
或者用kdiff3同样的方式
git difftool -d --tool=kdiff3 base:src/ master:src/
【讨论】: