[英]git - set KDiff3 as default mergetool
After installing KDiff3
for managing conflicts in git
, still the default one is opening for me: 在安装了用于管理
git
冲突的KDiff3
之后,仍然默认为我打开一个:
Here is the configuration that mentioned in this answer : 这是此答案中提到的配置:
git config --global --add merge.tool kdiff3
git config --global --add mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global --add mergetool.kdiff3.trustExitCode false
git config --global --add diff.guitool kdiff3
git config --global --add difftool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global --add difftool.kdiff3.trustExitCode false
NOTE: I can be able to run KDiff3
individually with simple files, but I can't run it in my git project. 注意:我可以使用简单的文件单独运行
KDiff3
,但不能在git项目中运行它。 Any idea? 任何想法?
Edit: Here is my .gitconfig : 编辑:这是我的.gitconfig:
[user]
email = vahid.vdn@gmail.com
name = vahid najafi
[diff]
tool = kdiff3
guitool = kdiff3
[merge]
tool = diffmerge
tool = kdiff3
tool = kdiff3
[mergetool "diffmerge"]
trustExitCode = true
[mergetool "kdiff3"]
path = C:/Program Files/KDiff3/kdiff3.exe
trustExitCode = false
[difftool "kdiff3"]
path = C:/Program Files/KDiff3/kdiff3.exe
trustExitCode = false
Finally I made another solution! 最后,我提出了另一个解决方案! I used
meld
instead of kdiff3
. 我用了
meld
而不是kdiff3
。 First download meld from here . 首先从这里下载融合 。 Then change config for
meld
in c:/Users/yourName/.gitconfig : 然后,更改配置为
meld
在C:/Users/yourName/.gitconfig:
[user]
email = vahid.vdn@gmail.com
name = vahid najafi
[diff]
tool = meld
[difftool "meld"]
path = C:/Program Files (x86)/Meld/meld/meld.exe
[difftool]
prompt = false
[merge]
tool = meld
[mergetool "meld"]
path = C:/Program Files (x86)/Meld/meld/meld.exe
[mergetool]
keepBackup = false
NOTE: Try to use git cmd
instead of windows cmd
. 注意:尝试使用git
cmd
代替Windows cmd
。 When you have conflict, just run : git mergetool
. 发生冲突时,只需运行:
git mergetool
。 For more detail and example, see here . 有关更多详细信息和示例,请参见此处 。
I do not know kdiff3
, but you might need to add the files you want to compare to your tool call as parameters (see command line options for KDiff3 call here ). 我不知道
kdiff3
,但是您可能需要将要与工具调用进行比较的文件作为参数添加(请参阅此处的 KDiff3调用的命令行选项)。 In your global config (accessible via git config --global -e
), the respective lines should look something like this: 在您的全局配置(可通过
git config --global -e
访问)中,相应的行应如下所示:
[merge]
tool = kdiff3
[mergetool "kdiff3"]
trustExitCode = false
cmd = 'C:/Program Files/KDiff3/kdiff3.exe' "$LOCAL" "$BASE" "$REMOTE" "$MERGED"
Since I did not try this with KDiff3, you might have to switch the order of "$LOCAL" "$BASE" "$REMOTE"
and "$MERGED"
variables, but this post sould provide enough additional more information on this. 由于我没有使用KDiff3尝试此操作,因此您可能必须切换
"$LOCAL" "$BASE" "$REMOTE"
和"$MERGED"
变量的顺序,但是此帖子可以提供足够的更多有关此信息。 Although it's about the Meld tool, I'm pretty sure the handling is analogical, and there are some pretty good and informative answers. 尽管它与Meld工具有关,但是我敢肯定这种处理是类比的,并且有一些很好的信息。
EDIT: Assuming you use windows: You can just locate it in Windows explorer, usually in c:\\user\\yourusername\\.gitconfig
, and open it with any editor. 编辑:假设您使用Windows:您可以在Windows资源管理器中找到它,通常在
c:\\user\\yourusername\\.gitconfig
,然后使用任何编辑器将其打开。 In Linux, see this post . 在Linux中,请参阅这篇文章 。 Then, replace all the
merge
, mergetool
and difftool
sections with the following: 然后,将所有
merge
, mergetool
和difftool
替换为以下内容:
[merge]
tool = kdiff3
[mergetool "kdiff3"]
cmd = "C:/Program Files/KDiff3/kdiff3.exe" "$LOCAL" "$BASE" "$REMOTE" "$MERGED"
trustExitCode = false
[difftool "kdiff3"]
cmd = "C:/Program Files/KDiff3/kdiff3.exe" "$LOCAL" "$BASE" "$REMOTE" "$MERGED"
trustExitCode = false
If ot does not work, it is possible that you have to change the order of "$LOCAL" "$BASE" "$REMOTE"
and "$MERGED"
variables or remove one of them. 如果ot不起作用,则可能必须更改
"$LOCAL" "$BASE" "$REMOTE"
和"$MERGED"
变量的顺序或删除其中之一。 You can find sufficient information about this in the links provided above. 您可以在上面提供的链接中找到足够的信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.