我试图让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
这是我的~/.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
我的 git --version
是:
git version 2.25.1
当我尝试运行命令
git difftool file_in_git_repo
时,Beyond Compare会打开左侧窗口显示当前版本,但右侧窗口没有内容(我已确认文件在git repo中存在)。
.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)\"