我已经在 Git 中安装了 Meld 作为 diff 工具。是否可以使用 Git 或任何其他方式比较两个文件夹?我尝试了以下命令,但没有任何反应。
git diff /c/sample/folder1/ /c/sample/folder2/
如果您想比较磁盘上的两个目录,则不需要
git
:
# use any suitable diff viewer : meld, kdiff3 ...
meld /c/sample/folder1/ /c/sample/folder2/
如果你想在 git 中获得两次提交之间差异的目录视图:
git difftool -d <commit1> <commit2>
# you can also restrict this directory view to a subdir of your repo :
git difftool -d <commit1> <commit2> -- lib/
[更新]回答@DamianBirchler 评论:
比较提交中的两个目录:
git difftool -d <commit>:path/to/dir1 <commit>:path/to/dir2
这实际上适用于任何两个提交(实际上指向 git 中的两棵树的任何内容):
git difftool -d <commit1>:config <commit2>:new/path/to/config