Oh my word. I don’t know what else to say. This was waaaay harder than I thought it would be. The goal was to able to open up two files from different branches and see the changes between them. the git command “difftool” looked to be the secret sauce and everything was working great until I tried to diff a file with a space in the name. That’s when the wheels fell off.
Here’s the command I was running:
git difftool Release-15.5 Release-16.1 “Sample File.sql”
Okay here are some of the gotchas I ran into:
- git on cygwin uses its own .gitconfig. It does not use the one at the standard windows path (e.g. “C:\Users\psteffek\.gitconfig”). It uses the one at “C:\cygwin64\home\psteffek\.gitconfig”. And just in case this wasn’t obvious “psteffek” is my username. Replace it with yours.
- Paths or files with spaces in them make for trouble and need to be escaped.
- Use the command: git config –list
This will help you confirm you are modifying the correct file.
Here’s what I ended up with and it seems to be working wonderfully 🙂
[diff] tool = kdiff3 [difftool "kdiff3"] cmd = \"C:/Program Files (x86)/KDiff3/kdiff3.exe\" \"$(cygpath -wla \"$LOCAL\")\" \"$(cygpath -wla \"$REMOTE\")\" trustExitCode = false [merge] tool = kdiff3 [mergetool "kdiff3"] cmd = \"C:/Program Files (x86)/KDiff3/kdiff3.exe\" "$(cygpath -wla $LOCAL)" \"$(cygpath -wla \"$REMOTE\")\" keepBackup = false trustExitCode = false [difftool] prompt = false