Git Diff with Beyond Compare

前端 未结 17 1981
醉酒成梦
醉酒成梦 2020-11-30 16:39

I have succeeded in getting git to start Beyond Compare 3 as a diff tool however, when I do a diff, the file I am comparing against is not being loaded. Only the latest ver

相关标签:
17条回答
  • 2020-11-30 17:11

    Thanks to @dahlbyk, the author of Posh-Git, for posting his config as a gist. It helped me resolve my configuration issue.

    [diff]
        tool = bc3
    [difftool]
        prompt = false
    [difftool "bc3"]
        cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"
    [merge]
        tool = bc3
    [mergetool]
        prompt = false
        keepBackup = false
    [mergetool "bc3"]
        cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"
        trustExitCode = true
    [alias]
        dt = difftool
        mt = mergetool
    
    0 讨论(0)
  • 2020-11-30 17:14

    Run these commands for Beyond Compare 2:

    git config --global diff.tool bc2
    git config --global difftool.bc2.cmd "\"c:/program files (x86)/beyond compare 2/bc2.exe\" \"$LOCAL\" \"$REMOTE\""
    git config --global difftool.prompt false
    

    Run these commands for Beyond Compare 3:

    git config --global diff.tool bc3
    git config --global difftool.bc3.cmd "\"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\""
    git config --global difftool.prompt false
    

    Then use git difftool

    0 讨论(0)
  • 2020-11-30 17:14

    The difference is in the exe being called: set it up to call bcomp.exe and it'll work fine. Configure your environment to call bcompare.exe and you'll end up with the side of the comparison taken from your revision system being empty.

    0 讨论(0)
  • 2020-11-30 17:16

    Official documentation worked for me

    0 讨论(0)
  • 2020-11-30 17:17

    The Beyond Compare support page is a bit brief.

    Check my diff.external answer for more (regarding the exact syntax)

    Extract:

    $ git config --global diff.external <path_to_wrapper_script>
    

    at the command prompt, replacing with the path to "git-diff-wrapper.sh", so your ~/.gitconfig contains

    -->8-(snip)--
    [diff]
        external = <path_to_wrapper_script>
    --8<-(snap)--
    

    Be sure to use the correct syntax to specify the paths to the wrapper script and diff tool, i.e. use forward slashed instead of backslashes. In my case, I have

    [diff]
        external = c:/Documents and Settings/sschuber/git-diff-wrapper.sh
    

    in .gitconfig and

    "d:/Program Files/Beyond Compare 3/BCompare.exe" "$2" "$5" | cat
    

    in the wrapper script.


    Note: you can also use git difftool.

    0 讨论(0)
  • 2020-11-30 17:18

    Here is my config file. It took some wrestling but now it is working. I am using windows server, msysgit and beyond compare 3 (apparently an x86 version). Youll notice that I dont need to specify any arguments, and I use "path" instead of "cmd".

    [user]
            name = PeteW
            email = petew@petew.com
    [diff]
            tool = bc3
    [difftool]
            prompt = false
    [difftool "bc3"]
            path = /c/Program Files (x86)/Beyond Compare 3/BComp.exe
    [merge]
            tool = bc3
    [mergetool]
            prompt = false
            keepBackup = false
    [mergetool "bc3"]
            path = /c/Program Files (x86)/Beyond Compare 3/BComp.exe
            trustExitCode = true
    [alias]
            dt = difftool
            mt = mergetool
    
    0 讨论(0)
提交回复
热议问题