0

For demo purposes I was trying to configure the diff tool for Git to WinDiff.

However, the last command failed and gave the git config help:

C:\...> git config --global diff.tool windiff

C:\...> git config --global difftool.windiff.path "C:\Program Files (x86)\WinDiff\"

C:\...> git config --global difftool.windiff.cmd "C:\Program Files (x86)\WinDiff\WinDiff.exe"

C:\...> git config --global difftool.windiff.cmd "C:\Program Files (x86)\WinDiff\WinDiff.exe" 
"$LOCAL" "$REMOTE"
usage: git config [<options>]

Config file location
    --global              use global config file
    --system              use system config file
    --local               use repository config file
[...]

(the line break between WinDiff.exe and "$LOCAL" is just for readability)

My Question

I can't figure out myself what I'm doing wrong. How do I set up WinDiff as the diff tool?

This is more an academic question. I don't actually want to use WinDiff, but I am preparing a training for Git and I would like to understand why that happens and how to resolve it, since I'll probably be a main contact regarding Git questions.

D:\...> git version
git version 2.13.0.windows.1

I have tried

Since the last command did not work, I looked up how WinMerge was set up:

D:\...> git config --get difftool.winmerge.cmd
"C:/Program Files (x86)/WinMerge/winmergeu.exe" -e -u "$LOCAL" "$REMOTE"

I saw that it uses forward slashes, so I tried that, too:

C:\...> git config --global difftool.windiff.cmd "C:/Program Files (x86)/WinDiff/WinDiff.exe" 
"$LOCAL" "$REMOTE"

usage: git config [<options>]

Config file location
    --global              use global config file
    --system              use system config file
    --local               use repository config file
[...]

Unsetting does not help either:

C:\...> git config --global --unset difftool.windiff.cmd

I have tried on my colleague's PC with the same result.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222

1 Answers1

0

Please Follow Steps Given Below :

1) copy windiff.exe to C:/WinDiff.exe

2) create wrapper file C:/windiff/windiff.sh :

#!/bin/sh
"C:/WinDiff.exe" "$1" "$2"

3) add windiff directory to path via cmd (in admin mode) :

setx path "%path%;C:\windiff"

4) add to .gitconfig (in C:/user/xxx/.gitconfig):

[diff] 
tool = windiff 
[difftool "windiff"] 
cmd = windiff.sh \"$LOCAL\" \"$REMOTE\" 
[difftool] 
prompt = false

5) use it with:

git difftool

OR

git difftool FILENAME
LuFFy
  • 8,799
  • 10
  • 41
  • 59
  • @ThomasWeller, I see you have tried many alternatives, try above solution, it worked for me in windows environment. – LuFFy Jun 20 '17 at 09:47