为了在 git 中比较二进制文件,我假设我需要设置一个 difftool。
什么 difftools 工作?怎么把参数放进去?
我尝试使用万花筒git difftool来比较两个分支。
所以我安装了ksdiff并将其设置为按照我的.gitconfig
[diff]
tool = kaleidoscope
[difftool "kaleidoscope"]
cmd = ksdiff --changeset $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
Run Code Online (Sandbox Code Playgroud)
跑步时
git difftool myBranch otherBranch
Run Code Online (Sandbox Code Playgroud)
我收到错误 cannot use duplicate files within the same file list
我可以设置 WinMerge 以便它显示单个单词的确切差异吗?
到现在为止,整个单词/短语都被突出显示,即使只有一个字符不同(参见图片示例)。
第 11 行中的 URL 被完全突出显示,即使只有一个字符 (" http" vs " https") 不同

我使用的是 Linux Mint 17 64 位。刚刚清除git并重新安装apt。已删除~/.gitconfig。我在所谓的全新安装后所做的唯一配置是(在存储库内)
git config diff.tool vimdiff
Run Code Online (Sandbox Code Playgroud)
然后我跑
git difftool HEAD:switch-monitor.sh master:switch-monitor.sh
Run Code Online (Sandbox Code Playgroud)
并得到
fatal: cannot exec 'git-difftool--helper': Bad address
external diff died, stopping at HEAD:switch-monitor.sh.
Run Code Online (Sandbox Code Playgroud)
因此,我删除了相关行.git/config并再次尝试该命令,果然内置的基本git diff工作正常。
我还尝试了本教程中的说明:http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/
这会导致略有不同但相似的错误。我将以下内容放入新的~/.gitconfig
[diff]
external = git_diff_wrapper
[pager]
diff =
Run Code Online (Sandbox Code Playgroud)
git_diff_wrapper并在 my 上放置一个可执行文件PATH,然后运行
git diff HEAD:switch-monitor.sh master:switch-monitor.sh
Run Code Online (Sandbox Code Playgroud)
并得到
fatal: cannot exec 'git_diff_wrapper': Bad address
external diff died, stopping at HEAD:switch-monitor.sh.
Run Code Online (Sandbox Code Playgroud)
不过好像和内容没什么关系git_diff_wrapper。我放置了
git config diff.tool …Run Code Online (Sandbox Code Playgroud) 我想使用 cmd.exe 批处理文件来比较一堆文件fc。不幸的是,fc每对比较文件的报告都表明,如果没有差异,则没有发现任何差异。如何更改该行为,以便在没有差异时保持沉默,并且仅在文件确实不同时报告?
我真的很喜欢 git diff 的输出格式,我git diff --no-index经常使用它来比较任意的非 git 相关文件。但据我所知,在使用 --no-index 时,您只能提供一对文件。我真的很希望能够将它传递多对,例如:
git diff --no-index a.new a.old b.new b.old
Run Code Online (Sandbox Code Playgroud)
并通过git diff在 repo 中运行获得那种输出:
diff --git a/a b/a
index e965047..ce01362 100644
--- a/a
+++ b/a
@@ -1 +1 @@
-Hello
+hello
diff --git a/b b/b
index 2b60207..dd7e1c6 100644
--- a/b
+++ b/b
@@ -1 +1 @@
-Goodbye
+goodbye
Run Code Online (Sandbox Code Playgroud)
有没有办法用 git diff 或类似的工具来做到这一点?
difftool ×6
git ×4
diff ×2
cmd.exe ×1
command-line ×1
comparison ×1
linux ×1
vimdiff ×1
winmerge ×1