jor*_*son 6 git beyondcompare wsl-2
尝试将 git 和 Beyond Compare 很好地放在 WSL 上。这是以下的输出git config --list:
diff.tool=bc3
difftool.prompt=false
difftool.bc3.path=/mnt/c/Program Files/Beyond Compare 4/BComp.exe
merge.tool=bc3
mergetool.prompt=false
mergetool.bc3.trustexitcode=true
mergetool.bc3.path=/mnt/c/Program Files/Beyond Compare 4/BComp.exe
Run Code Online (Sandbox Code Playgroud)
这是我的~/.gitconfig:
[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]
path = /mnt/c/Program Files/Beyond Compare 4/BComp.exe
[merge]
tool = bc3
[mergetool]
prompt = false
[mergetool "bc3"]
trustExitCode = true
path = /mnt/c/Program Files/Beyond Compare 4/BComp.exe
Run Code Online (Sandbox Code Playgroud)
我的git --version is:
git version 2.25.1
Run Code Online (Sandbox Code Playgroud)
当我尝试git difftool file_in_git_repo
Beyond Compare 时,左窗格中会打开当前版本,但右窗格中没有任何内容(我已确认该文件存在于 git 存储库中。)
.git/config没有引用 diff 或 merge 的条目
任何建议将非常受欢迎
=================================================== =====================
与 VonC 的建议类似,我能够在我的 .gitconfig 文件中使用它(免责声明 - 我没有使用这种新方法的合并工具):
[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]
cmd = '/mnt/c/Program Files/Beyond Compare 4/BComp.exe' \"$(wslpath -aw $LOCAL)\" \"$(wslpath -aw $REMOTE)\"
[merge]
tool = bc3
[mergetool]
prompt = false
[mergetool "bc3"]
trustExitCode = true
cmd = '/mnt/c/Program Files/Beyond Compare 4/BComp.exe' \"$(wslpath -aw $LOCAL)\" \"$(wslpath -aw $REMOTE)\"
Run Code Online (Sandbox Code Playgroud)
检查此配置是否适合您的情况:
我设法使用新 WSL 版本附带的内置 wslpath 命令让它工作!
我在 WSL linux 端的 git 配置:
Run Code Online (Sandbox Code Playgroud)difftool.bc3.cmd=BComp.exe "$(wslpath -aw $LOCAL)" "$(wslpath -aw $REMOTE)" mergetool.bc3.cmd=BComp.exe "$(wslpath -aw $LOCAL)" "$(wslpath -aw $REMOTE)" "$(wslpath -aw $BASE)" "$(wslpath -aw $MERGED)"
BComp.exe在我的$PATH.
我在 Windows 版本 2004(内部版本 19041)上使用 WSL2,这既适用于 WSL 文件系统内部,也适用于已安装的 Windows 文件系统。新的
wslpath -awLinux 路径转换如下:Run Code Online (Sandbox Code Playgroud)$ wslpath -aw /home/ \\wsl$\Debian\homeWindows 路径如下:
Run Code Online (Sandbox Code Playgroud)$ wslpath -aw /mnt/c/Users/ C:\Users这使得它们在从 Linux 启动时可以与 Windows 版本的 BC 完美配合。
| 归档时间: |
|
| 查看次数: |
1927 次 |
| 最近记录: |