Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>Introduction</h2> <p>For reference I'd like to include my variation on VonC's answer. Keep in mind that I am using the MSys version of Git (1.6.0.2 at this time) with modified PATH, and running Git itself from Powershell (or cmd.exe), not the Bash shell.</p> <p>I introduced a new command, <code>gitdiff</code>. Running this command temporarily redirects <code>git diff</code> to use a visual diff program of your choice (as opposed to VonC's solution that does it permanently). This allows me to have both the default Git diff functionality (<code>git diff</code>) as well as visual diff functionality (<code>gitdiff</code>). Both commands take the same parameters, so for example to visually diff changes in a particular file you can type</p> <pre><code>gitdiff path/file.txt </code></pre> <h2>Setup</h2> <p>Note that <code>$GitInstall</code> is used as a placeholder for the directory where Git is installed.</p> <ol> <li><p>Create a new file, <code>$GitInstall\cmd\gitdiff.cmd</code></p> <pre><code>@echo off setlocal for /F "delims=" %%I in ("%~dp0..") do @set path=%%~fI\bin;%%~fI\mingw\bin;%PATH% if "%HOME%"=="" @set HOME=%USERPROFILE% set GIT_EXTERNAL_DIFF=git-diff-visual.cmd set GIT_PAGER=cat git diff %* endlocal </code></pre></li> <li><p>Create a new file, <code>$GitInstall\bin\git-diff-visual.cmd</code> (replacing <code>[visual_diff_exe]</code> placeholder with full path to the diff program of your choice)</p> <pre><code>@echo off rem diff is called by git with 7 parameters: rem path old-file old-hex old-mode new-file new-hex new-mode echo Diffing "%5" "[visual_diff_exe]" "%2" "%5" exit 0 </code></pre></li> <li><p>You're now done. Running <code>gitdiff</code> from within a Git repository should now invoke your visual diff program for every file that was changed.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload