运行:
GIT_TRACE=1 git difftool --tool-help
为了打印与--tool
一起使用但不可用的diff工具列表,请执行以下操作:
其次,我相信以下简化示例可能更好:
[difftool "webstorm"]
cmd = webstorm diff "$LOCAL" "$REMOTE"
或者通过指定二进制文件或脚本的路径来执行,例如:
[difftool]
prompt = NO
external = /usr/local/bin/diffmerge
通过以下方式检查diff配置:
git config --get-regex diff
更具体地说(用您的工具名称替换
webstorm
):
git config --get difftool.webstorm.cmd
如果仍然无法正常工作,请在新的代码库上进行测试,例如按照以下命令操作:
mkdir ~/git_test && cd ~/git_test
git init && touch file && git add file && git commit -m'Adds file' -a
echo changed >> file
GIT_TRACE=1 git difftool
如果以上方法可行,则请确保您的代码库配置没有任何意外情况,例如:
more "$(git rev-parse --show-toplevel)"/.git/config
如果您处于合并状态(通过git status
检查),则需要使用mergetool
,例如:
git mergetool
添加-t工具
以指定使用哪个工具。可以通过git mergetool --tool-help
来查看可用的工具列表。
另请参阅man git-difftool
:
CONFIG VARIABLES
git difftool falls back to git mergetool config variables when the difftool equivalents have not been
defined.
diff.tool
The default diff tool to use.
diff.guitool
The default diff tool to use when --gui is specified.
difftool.<tool>.path
Override the path for the given tool. This is useful in case your tool is not in the PATH.
difftool.<tool>.cmd
Specify the command to invoke the specified diff tool.
See the --tool=<tool> option above for more details.
difftool.prompt
Prompt before each invocation of the diff tool.
webstorm
的绝对路径? - user456814