Sourcetree无法打开Diffmerge进行合并冲突 [英] Sourcetree fails to open Diffmerge for merge conflicts

查看:637
本文介绍了Sourcetree无法打开Diffmerge进行合并冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Recently I had a fresh install of macOS. I've installed Sourctree and diffmerge and set diffmerge as the default merge tool. For some reason everytime when I select 'Resolve Conflicts -> Open External Merge Tool' sourcetree opens its waiting view and directly closes it.

我在源代码树中的设置页面:

My settings page in sourcetree:

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

This is how my root .gitconfig looks like when sourcetree configures diff merge for me:

[core]
    excludesfile = /Users/[username]/.gitignore_global
[user] 
    name = ---- -----
    email = -----@-----.--
[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配置).

This happend to me when diffmerge was installed via the pkg install instead of the installer. This appearantly does not configure your bash to know the command diffmerge so than you have to set the path to the diffmerge (or update your bin config).

为解决这个问题,我手动配置了Visual Diff工具和合并工具(这样做的好处是您可以在每次启动时禁用该烦人的启动屏幕).

To solve this I manually configured Visual Diff Tool and Merge Tool (with as benefit that you can disable that annoying splash screen on launch everytime).

sourcetree中的设置"页面

Settings page in sourcetree

差异

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

合并

命令:/usr/local/bin/diffmerge 参数--nosplash --merge --result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"

-nosplash参数是可选的,但可以防止在我开始工作之前总是必须关闭的弹出窗口(在我看来是无用的).

The --nosplash argument is optional but prevents the (in my opinion useless) pop up that you always have to close before you can start your work.

Git配置文件:

[core]
    excludesfile = /Users/[username]/.gitignore_global
[user]
    name = ---------
    email = ---------@------.--
[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命令行参数的更多信息:

More info about diffmerge command line arguments:

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

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

这篇关于Sourcetree无法打开Diffmerge进行合并冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆