git - 使用 vscode 作为 git 版本 (2.31.1) difftool
问题描述
我安装了 git 版本 2.31.1.windows.1 并按照所有 git 中显示的所有必要步骤逐步尝试使用 VSCode 作为我的主要 difftool,我将这些行放在 gitconfig 文件中:
[diff]
tool = vscode
[difftool "vscode"]
cmd = "code --wait --diff $LOCAL $REMOTE"
[difftool]
prompt = true
使用以下步骤:
git config --global diff.tool vscode
git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"
甚至在 Windows 中将 VSCode 添加到PATH中,虽然我在运行时打开 VSCode 没有问题git config --global -e
,但是当我输入命令时git difftool
没有任何反应,它只是开始一个新行。
解决方案
如果没有要显示的差异,git difftool
则不会打开任何东西——就像git diff
返回而不输出任何行一样。
git diff
/有一个已知的陷阱:没有进一步的参数,它显示暂存的内容与磁盘上的文件git difftool
之间的差异;如果您的所有更改都已暂存(ed ),则不会显示任何内容。git add
如果要查看与当前存储库状态相比暂存的更改,请运行:
git diff --cached
# or :
git difftool --cached
额外说明:一个有用的选项git difftool
是-d
:
git difftool -d --cached
git difftool -d <branch1> <branch2>
git difftool -d <anything that can get compared ...>
它不是一个一个打开文件,而是以“目录差异”模式打开您的差异查看器。
推荐阅读
- java - 无法将 byteArray 转换为 String 并反转
- java - 测试迭代器的第四个对象 - Java
- sql - 从oracle中的字符串派生值
- auth0 - 无法交换访问令牌的授权码 (feacft)
- jenkins - Jenkins 通过 ssh 部署作业
- android - 获取部分 JSON 并将其保存到 JSONArray
- c# - 在(字典)索引器上使用 C# 的 ref 功能
- tensorflow - 如何使用 TensorFlow 在一层中创建并行线性计算?
- mysql - 我想在插入值中将此分隔符字符串设置为列
- python - 配置解析器重复部分 python2 vs python3