0

I am using CYGWIN and Beyond Compare 4 Pro Edition. I have set up the following .gitconfig file:

[diff]
    tool = bc3
[difftool "bc3"]
    path = c:/program files/beyond compare 4/bcomp.exe
[merge]
    tool = bc3
[mergetool "bc3"]
    path = c:/program files/beyond compare 4/bcomp.exe

After making a small change to a local file, I run the following command in CYGWIN:

git difftool

Beyond Compare 4 launches correctly but only with the left side in all red. The right side is empty.

I would like this to launch with a simple comparison of my local changes (left) compared to the remote (right).

I was under the assumption that this was the default behavior? Is there another setting I am missing or is this only avaiable

jipot
  • 301
  • 3
  • 7
  • 23

3 Answers3

0

The configuration you listed should work correctly with Git for Windows 2.12.1.windows.1 in a Windows command prompt. I haven't tested it with Cygwin.

If you're using a Cygwin provided version of Git, it might help to switch to the Windows version of Git from https://git-scm.com/ instead. In the past, Cygwin's version of Git lagged the official Windows version pretty significantly. To check your version of Git, run "git --version".

Chris Kennedy
  • 2,101
  • 9
  • 8
0

I was able to solve my problem by configuring my .gitconfig file to the following:

[difftool "bc3"]
     cmd = \"c:/program files/beyond compare 4/bcomp.exe\" "$(cygpath -w $LOCAL)" "$REMOTE"

This brings up a diff of the local and remote when doing a git difftool

jipot
  • 301
  • 3
  • 7
  • 23
0

I had to modify jipot's answer above:

git config --system difftool.bc.cmd '"c:/program files/beyond compare 4/bcomp.exe" "$(cygpath -w $LOCAL)" "$(cygpath -w $REMOTE)"'

Going further, similarly for the mergetool:

git config --system mergetool.bc.cmd '"c:/program files/beyond compare 4/bcomp.exe" "$(cygpath -w $LOCAL)" "$(cygpath -w $REMOTE)" "$(cygpath -w $BASE)" "$(cygpath -w $MERGED)"'

As for the core.editor, if you want to use Sublime Text, you need to use an external script ~/git-editor.sh that contains the following command:

cygpath --windows $@ | sed 's/\\/\\\\/g' | tr '\n' '\0' | xargs -0 -n1 /cygdrive/c/Program\ Files/Sublime\ Text\ 3/subl.exe -n -w

I modified the above from Alexander Revo's post.

Then add it to your git core.editor config:

git config --system core.editor "~/git-editor.sh"

If you don't use an external script for the editor, git will cause Sublime text to open two files if you attempt to put $cygpath in the core.editor config as git will append the "wrong path" filename to the end of your core.editor setting.

kamion
  • 459
  • 2
  • 8