Git Diff with Beyond Compare

git difftool beyond compare windows
beyond compare git branches
git difftool beyond compare not working
sourcetree beyond compare
git extensions beyond compare
git difftool beyond compare all files
git beyond compare 4 windows
git diff tool

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 version of the file is loaded and nothing else, so there is nothing in the right pane of Beyond Compare.

I am running git 1.6.3.1 with Cygwin with Beyond Compare 3. I have set up beyond compare as they suggest in the support part of their website with a script like such:

#!/bin/sh  
# diff is called by git with 7 parameters:  
# path old-file old-hex old-mode new-file new-hex new-mode  
"path_to_bc3_executable" "$2" "$5" | cat

Has anyone else encountered this problem and know a solution to this?

Edit: I have followed the suggestions by VonC but I am still having exactly the same problem as before. I am kinda new to Git so perhaps I am not using the diff correctly.

For example, I am trying to see the diff on a file with a command like such: git diff main.css

Beyond Compare will then open and only display my current main.css in the left pane, there is nothing in the right pane. I would like the see my current main.css in the left pane compared to the HEAD, basically what I have last committed.

My git-diff-wrapper.sh looks like this:

#!/bin/sh  
# diff is called by git with 7 parameters:  
# path old-file old-hex old-mode new-file new-hex new-mode  
"c:/Program Files/Beyond Compare 3/BCompare.exe" "$2" "$5" | cat

My git config looks like this for Diff:

[diff]  
external = c:/cygwin/bin/git-diff-wrapper.sh

I don't use extra wrapper .sh files. My environment is Windows XP, git 1.7.1 on cygwin, and Beyond Compare 3. Following is my .git/config file.

[diff]
    tool = bc3
[difftool]
    prompt = false
[difftool "bc3"]
    #use cygpath to transform cygwin path $LOCAL (something like /tmp/U5VvP1_abc) to windows path, because bc3 is a windows software
    cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$(cygpath -w $LOCAL)" "$REMOTE"
[merge]
    tool = bc3
[mergetool]
    prompt = false
[mergetool "bc3"]
    #trustExitCode = true
    cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"

Then, I use $ git difftool to compare and $ git mergetool to merge.

About trustExitCode: For a custom merge command, specify whether the exit code of the merge command can be used to determine whether the merge was successful. If this is not set to true then the merge target file timestamp is checked and the merge assumed to have been successful if the file has been updated, otherwise the user is prompted to indicate the success of the merge.

Beyond Compare Technical Support, Hi, I've managed to use Beyond Compare for comparing branches using the folder diff, by launching the following command: $ git difftool -d  git difftool 4e560^^ --dir-diff #4e560 is your commit hash that you want to show a whole directory-diff on in BC Beyond Compare 3 has a bug that is not fixed as of v3.3.12 where you need to employ this workaround. If you don’t do it, bcomp.exe will exit too early, and no files will be available to diff while you are viewing the directory diff.

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

Comparing git branches using folder diff, Currently I am using git diff to do this: git diff commit_a commit_b. How can I do this using difftool and beyond compare? Tags: None  Beyond Compare comes with a couple dozen file formats, viewable at Tools->FileFormats. When BC opens a file, it checks the filename extension (.html,.jpg,.js,.h, et cetera) against its known list of file formats. (You can write your own format types. You can also download more formats at the official Scooter Software site.)

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

How to use beyond compare to compare between two git commits , I don't use extra wrapper .sh files. My environment is Windows XP, git 1.7.1 on cygwin, and Beyond Compare 3. Following is my .git/config file. Set up Becond Compare as difftool and mergetool in Git. Last updated: 2018-12-18 Environment: Windows, Git v2.13.2 You can use git commands or directly edit global git config file to configure Beyond Compare as difftool and mergetool. Method 1 : use git commands # Config Beyond Compare 4 as difftool $ git config --global diff.tool … Continue reading "Setting up Beyond Compare as difftool and

Official documentation worked for me

Git Diff with Beyond Compare, Beyond Compare has been my favorite comparison tool for a while now . It is cross-platform and makes diffs and 3-way merges very easy to… Empty directories in Git; External merge and difftools; Setting up an IntelliJ IDE as diff tool (Windows) Setting up an IntelliJ IDE as merge tool (Windows) Setting up Beyond Compare; Setting up KDiff3 as diff tool; Setting up KDiff3 as merge tool; Git Branch Name on Bash Ubuntu; Git Clean; Git Client-Side Hooks; Git Diff; Git GUI Clients; Git

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

Configuring Beyond Compare with Git, //Git Mergetool and difftool with Beyond Compare 4. //For Windows. //IF running this command in git bash then escape $ with \. git config --global diff.tool bc4. it means that your git does not support(can not find) beyond compare as difftool right now. In order for Git to find beyond compare as valid difftool, you should have Beyond Compare installation directory in your system path environment variable. You can check this by running bcompare from shell(cmd, git bash or powershell.

Git Mergetool and difftool with Beyond Compare 4 · GitHub, git config --global diff.tool bc. git config --global difftool.bc.path "C:\Program Files\​Beyond Compare 4\BComp.exe". git config --global merge.tool bc. git config  Beyond Compare is a multi-platform utility that combines directory compare and file compare functions in one package. Use it to manage source code, keep directories in sync, compare program output, etc.

Configure Beyond Compare 4 as git diff tool on windows 10 · GitHub, git config --global difftool.bc3.path 'c:\Program Files (x86)\Beyond Compare 3\​bcomp.exe'. and configure bc3 as default. git config --global diff.tool bc3. Found a​  //Git Mergetool and difftool with Beyond Compare 4 //For Windows //IF running this command in git bash then escape $ with \ git config --global diff.tool bc4

External merge and diff tools / Setting up Beyond Compare , Using git diff is ok when you are looking at a small set of changes but if there are many changes across many files I much prefer to use beyond  Beyond Compare is a multi-platform utility that combines directory compare and file compare functions in one package. Use it to manage source code, keep directories in sync, compare program output, etc.

Comments
  • I'm running in windows 7 with a mingw git shell. I had to use a linux style path /c/program files instead of c:/program files. Also I removed the "$(cygpath -w $LOCAL)" and just used "$LOCAL". That seemed to do the trick.
  • As @pClass mentions below, "bc3" is now an internal tool in newer versions of git. You should use a unique name, such as "beyondcompare3"
  • GitHub Shell (on Windows 8) told me bcompare: command not found- until I changed the NAME of the tool from bc3 to something else (like abc3). I guess that some internal Github setting interfered. Also, I removed the "$(cygpath -w $LOCAL)" part and replaced it with "$LOCAL". Now it works just fine. Thanks!
  • This was buggy for me when looking at diff between two commits. Here is a better solution: blog.kifaru.be/2011/07/…
  • I also found this article: scootersoftware.com/support.php?zz=kb_vcs
  • I tried this answer and was unable to diff, maybe I'm doing it wrong.
  • @Epu did you confirm your paths are the same on your machine? And it is Beyond Compare 3, not an older v2 or something?
  • I confirmed the paths are the same, and that it's bc3.
  • Funny thing is, 'git difftool file.txt' and 'git mergetool file.txt' are working ok, so I switched to those. But 'git diff file.txt' is now busted (before it used to show me the default console diff). Now it gives me 'error: cannot spawn bc3: No such file or directory\nexternal diff died, stopping at file.txt'
  • Just in case anyone faces the same problem I did (unrecognized .gitconfig after editing it) I had to add the path as follows: cmd = 'C:\\Program Files\\Beyond Compare 4\\BCompare.exe' \"$LOCAL\" \"$REMOTE\"
  • Is Beyond Compare 4 supported?
  • @Danijel the official doc stated in @Daniel Magnussons answer states Note: Use bc3 on the command line for both BC version 3 and 4
  • Thanks man for pointing me to official doc!!! at least it specifies what diff config needed for GIT vs GitHub
  • You really should use cygpath for this; e.g. bcompare.exe $(cygpath -w $2). Cheers.