最近我重新安装了 macOS。我已经安装了 Sourctree 和 diffmerge 并将 diffmerge 设置为默认合并工具。出于某种原因,每次当我选择“解决冲突 - > 打开外部合并工具”时,源树都会打开其等待 View 并直接关闭它。

我在 sourcetree 中的设置页面:

atlassian-sourcetree - Sourcetree 无法为合并冲突打开 Diffmerge-LMLPHP

这是当 sourcetree 为我配置差异合并时我的根 .gitconfig 的样子:

[core]
    excludesfile = /Users/[username]/.gitignore_global
[user]
    name = ---- -----
    email = [email protected]
[commit]
    template = /Users/[username]/.stCommitMsg
[credential]
    helper =  !/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java -Ddebug=false -Djava.net.useSystemProxies=true -jar /usr/local/Cellar/git-credential-manager/2.0.4/libexec/git-credential-manager-2.0.4.jar

[difftool "DiffMerge"]
[mergetool "DiffMerge"]
[diff]
    tool = diffmerge
[difftool "diffmerge"]
    cmd = /usr/local/bin/diffmerge \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = diffmerge
[mergetool "diffmerge"]
    trustExitCode = true
    cmd = /usr/local/bin/diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
[difftool "sourcetree"]
    cmd = /Applications/DiffMerge.app/Contents/MacOS/DiffMerge/Contents/MacOS/DiffMerge --nosplash \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
    cmd = /Applications/DiffMerge.app/Contents/MacOS/DiffMerge/Contents/MacOS/DiffMerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
    trustExitCode = true

最佳答案

当通过 pkg install 而不是安装程序安装 diffmerge 时,这发生在我身上。这似乎不会将您的 bash 配置为知道命令 diffmerge,因此您必须设置 diffmerge 的路径(或更新您的 bin 配置)。

为了解决这个问题,我手动配置了 Visual Diff Tool 和 Merge Tool(好处是你可以在每次启动时禁用烦人的启动画面)。

sourcetree 中的设置页面

atlassian-sourcetree - Sourcetree 无法为合并冲突打开 Diffmerge-LMLPHP

差异

命令:/usr/local/bin/diffmerge参数 --nosplash "$LOCAL" "$REMOTE"
合并

命令:/usr/local/bin/diffmerge参数 --nosplash --merge --result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"
--nosplash 参数是可选的,但可以防止(在我看来是无用的)弹出窗口,您在开始工作之前总是必须关闭它。

git配置文件:

[core]
    excludesfile = /Users/[username]/.gitignore_global
[user]
    name = ---------
    email = [email protected]
[commit]
    template = /Users/[username]/.stCommitMsg
[credential]
    helper = !/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java -Ddebug=false -Djava.net.useSystemProxies=true -jar /usr/local/Cellar/git-credential-manager/2.0.4/libexec/git-credential-manager-2.0.4.jar

[difftool "DiffMerge"]
[mergetool "DiffMerge"]
[diff]
    tool = diffmerge
[difftool "diffmerge"]
    cmd = /usr/local/bin/diffmerge \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = diffmerge
[mergetool "diffmerge"]
    trustExitCode = true
    cmd = /usr/local/bin/diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
[difftool "sourcetree"]
    cmd = /usr/local/bin/diffmerge --nosplash \"$LOCAL\" \"$REMOTE\"
    path =
[mergetool "sourcetree"]
    cmd = /usr/local/bin/diffmerge --nosplash --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
    trustExitCode = true

有关 diffmerge 命令行参数的更多信息:

差异:https://sourcegear.com/diffmerge/webhelp/sec__clargs__diff.html

合并:https://sourcegear.com/diffmerge/webhelp/sec__clargs__merge.html

关于atlassian-sourcetree - Sourcetree 无法为合并冲突打开 Diffmerge,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53249870/

10-13 07:36