超越4与git for windows:无法使用git diff打开

时间:2015-08-27 11:31:15

标签: git beyondcompare beyondcompare4

我想使用Beyond compare 4来为Windows中的git存储库执行merge和diff。我已经设置了以下.gitconfig但是当我在shell中执行git diff时,我在控制台中获取文本差异,而不是打开BC4。

我做错了什么?

这是我的.gitconfig

[merge]
    tool = BeyondCompare4
[diff]
    guitool = BeyondCompare4
    tool = BeyondCompare4
[core]
    editor = \"C:/Program Files (x86)/Vim/vim74/gvim.exe\"
    autocrlf = True
[user]
    name = My name
    email = my@mail
[difftool "BeyondCompare4"]
    cmd = \"C:/Program Files (x86)/Beyond Compare 4/Bcomp.exe\" \"$LOCAL\" \"$REMOTE\"
[mergetool "BeyondCompare4"]
    cmd = \"C:/Program Files (x86)/Beyond Compare 4/Bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"
    trustExitCode = true
[push]
    default = simple
[alias]
    lg = log --pretty=format:'%C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)' --decorate --graph --all --abbrev-commit
    lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
    lastcommit = log --name-status HEAD^..HEAD
    lastdiff = diff HEAD^..HEAD
[filter "lfs"]
    clean = git-lfs clean %f
    smudge = git-lfs smudge %f
    required = true

2 个答案:

答案 0 :(得分:2)

以下是我设置.gitconfig文件的方法。看看Beyond和Compare不需要params。

[diff]
    tool = bc
    mnemonicprefix = true
[difftool]
    prompt = false
[difftool "bc"]
    path = C:\\Program Files\\Beyond Compare 4\\bcomp.exe
    trustexistcode = true
[merge]
    tool = bc
[mergetool]
    prompt = false
[mergetool "bc"]
    path = C:\\Program Files\\Beyond Compare 4\\bcomp.exe
    keepbackup = false
    trustexistcode = true

答案 1 :(得分:1)

要在外部工具中启动差异,请运行 git difftool

对于合并,请运行 git mergetool