使用Kdiff3 来解决Git的文件冲突

Kdiff3 的下载地址为:

http://kdiff3.sourceforge.net/

要想在Git GUI 中增加Merge Tool 有2种方式:

一,在”.gitconfig ” 文件中进行修改。

.gitconfig 文件通常会在

image

用记事本打开它,把下面的文本加进去就行了。

[merge]
        tool = kdiff3
[mergetool "kdiff3"]
        path = c:/Program Files/KDiff3/kdiff3.exe
[diff]
        tool = kdiff3
        guitool = kdiff3
[difftool "kdiff3"]
        path = c:/Program Files/KDiff3/kdiff3.exe

注:1,kdiff3.exe 的路径肯定是你安装Kdiff3的路径。2,不要盲目复制看清楚path与你的文件系统目录是有区别的哈。

二,通过Git Bash来完成。

因为没有试这种方式就直接上答案:

I've been looking for the silver bullet solution to using KDiff3 as my git mergetool on Windows (using Git GUI).  I've finally got a solution that works in every Windows environment I've tried:

  1. Add the KDiff3 directory to your Windows System Path (e.g. C:\Program Files\KDiff3\)
  2. Add kdiff3 as your Git mergetool (From Git Bash, run git config --global merge.tool kdiff3)
  3. Add kdiff3 complete path to Git Config (From Git Bash, run git config --global meregtool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe")
  4. Go into Git GUI settings and set the mergetool to kdiff3 (if Git GUI doesn't pick up this setting from git config, which it should)

Regardless of what I tried and/or read online, setting all possible settings is the only way KDiff3 works every time I select "Run Merge Tool" from the Git GUI right-click menu when there is a merge conflict.

Cheers,
-Kevin Wentworth

参考地址:http://www.mainelydesign.com/blog/view/using-kdiff3-as-git-gui-merge-tool-on-windows-xp-windows-7

posted @ 2011-10-25 11:13  吉桂昕  阅读(7289)  评论(0编辑  收藏  举报