Git Under Cygwin or Git Bash Shell

The following instructions are for the version of GIT included with Cygwin or the default Git Bash Shell. The following commands are run from a cygwin bash shell window.

This version of GIT invokes external diff/merge tools using cygwin-style pathnames, such as /tmp/foo (which is relative to the root of the cygwin directory). These pathnames are not understood by DiffMerge. A shell script wrapper sgdm_cygwin.sh has been provided (in the same directory as the sgdm.exe executable) to translate these pathnames and launch DiffMerge.

The following commands will update your .gitconfig to let the Cygwin version of GIT use DiffMerge:

$ git config --global diff.tool diffmerge
$ git config --global difftool.diffmerge.cmd
    "C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm_cygwin.sh
        -p1=\"\$LOCAL\" -p2=\"\$REMOTE\""
	      
$ git config --global merge.tool diffmerge
$ git config --global mergetool.diffmerge.trustExitCode true
$ git config --global mergetool.diffmerge.cmd 
    "C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm_cygwin.sh
        -merge -result=\"\$MERGED\"
            -p1=\"\$LOCAL\" -p2=\"\$BASE\" -p3=\"\$REMOTE\""
	    

Note that both of the ....diffmerge.cmd ... lines were wrapped for this document. You can verify your settings with the git config --list command.

Note that each of the input pathnames is associated with a /pX= option instead of being an unbound parameter.

The commands above assume that the MSI installer was used to install DiffMerge in the standard location. If you installed DiffMerge from the ZIP package, be sure to adjust the pathname to sgdm.exe accordingly.