I've just started using Git and it's possible I've missed something obvious, but here goes:
- I'm using msysgit 1.6.2.2 on Windows XP
- While installing, I picked option 1 to "Use Git Bash only"
I'm trying to put together a wrapper script that I can use to replace the built in git diff with DiffMerge. Based on this thread on SO, I created the following batch file:
@echo off
REM ---- Switch forward slashes to back slashes ----
set oldW=%2
set oldW=%oldW:/=\%
set newW=%5
set newW=%newW:/=\%
REM ---- Launch DiffMerge ----
"C:/Programs/SourceGear/DiffMerge/DiffMerge.exe" /title1="Old Version" %oldW% /title2="New Version" %newW%
I placed the bat file under %GIT_INSTALL%/cmd and edited my .gitconfig file as follows:
[diff]
external = C:/Programs/git/cmd/git-diff-wrapper.bat
If i launch Git Bash and execute git diff HEAD HEAD~ -- myfile
I get a message File (\dev\null) not found
- which given I'm on Windows is not surprising.
Pressing on, I launched gitk and under Edit>Preferences, I chose the same wrapper script. Trying the "external diff" option for a particular file gives the cryptic error message Unknown Option "
Clearly, I have no idea what I'm doing anymore so any help would be much appreciated.
I just experienced a somewhat similar experience with setting Notepad++ as my external editor with msysgit1.6.2.2.
The key was to realize the wrapper was not a DOS script, but a /bin/sh script.
So try to put in your ".bat" (even though it is not exactly a bat script, the extension is not important here):
Do not worry about making all the '
\
' go '/
': it is done by the Git scripts calling the external diff tool.I did not test it with DiffMerge, but with WinMerge, it works just fine, both from a DOS session or a Git Shell.
(with the '
-e
' option, I have just ot type on 'ESC
' to close and quit the diff tool: that works great!)1/ There actually is a way to see what are the parameters getting passed!
Add the following line in the
C:\Program Files\Git\libexec\git-core\git-sh-setup
file:You will see what editor is being called, with what parameter.
Now, regarding the "Unexpected parameter" part:
I did have the same kind of error when I called WinMergeU.exe with "
/e /ub
" instead of "-e -ub
", so first question is:Are you sure that the "
/title1
" bit could not be used as "-title1
" or "-t1
" or "--title1
" or "--t1
" ? That is what Is can see from the chapter 9 "Command Lines Arguments" of the pdf documentation of DiffMerge.If not, I suspect some double quotes are in order for delimiting properly the different parameters. Something like:
But my money would rather be on the "
-title1
" or "-t1
" form:should work just fine.