Run:
GIT_TRACE=1 git difftool --tool-help
to print a list of diff tools that may be used with --tool
, and which are not available.
Secondly I believe the following simplified example may work better:
[difftool "webstorm"]
cmd = webstorm diff "$LOCAL" "$REMOTE"
Or by specifying the path to the binary or script, e.g.
[difftool]
prompt = NO
external = /usr/local/bin/diffmerge
Check the diff configuration by:
git config --get-regex diff
Or more specifically (replace webstorm
with your tool name):
git config --get difftool.webstorm.cmd
If still doesn't work, test it on the new repository, e.g. by following these commands:
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
If above works, then make sure your repository config doesn't have anything unexpected, e.g.
more "$(git rev-parse --show-toplevel)"/.git/config
If you're in merge state (check by git status
), you need to use mergetool
instead, e.g.
git mergetool
Add -t tool
to specify which tool. List available by git mergetool --tool-help
.
See also 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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…