2025年5月12日 星期一

在WLS中設定 git merge tool 為 winmerge.exe

因為工作時使用Windows Subsystem for Linux,

不像在原生Linux 中已經在安裝時設定好 git merge tool,

必須要自己手動設定。

在 WSL 中也缺少習慣的 GitGUI,

只能使用windows 中的去讀取 WSL 中的檔案。

 可以先用指令產生基本設定

git config --global merge.tool winmerge

git config --global merge.guitool winmerge

會在 ~/.gitconfig 中增加

[merge]
        tool = winmerge
        guitool = winmerge

 

意思合併時使用 winmerge 這個設定值

圖形化合併時,用 winmerge 這個設定值

 

之後手動增加 winmerge 設定值

#vim  ~/.gitconfig

 [mergetool "winmerge"]
            cmd = /mnt/c/Program\\ Files/WinMerge/WinMergeU.exe "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"
            trustExitCode = true

 

WinMerge

https://winmerge.org/?lang=zh_tw