gitdifftool

git difftool, open all diff files immediately, not in serial


The default git diff behavior is to open each diff file in serial (wait for previous file to be closed before opening next file).

I'm looking for a way to open all the files at once - in BeyondCompare for example this would open all the files in tabs within the same BC window.

This would make it easier to review a complex set of changes; flick back and forwards between the diff files and ignore unimportant files.


Solution

  • Here's what I settled on...

    Copy the following code to a file called git-diffall (no extension):

    #!/bin/sh
    git diff --name-only "$@" | while read filename; do
        git difftool "$@" --no-prompt "$filename" &
    done
    

    Place the file in the cmd folder of your git install dir (eg C:\Program Files (x86)\Git\cmd)

    And use like you would git diff:

    git diffall
    git diffall HEAD
    git diffall --cached 
    git diffall rev1..rev2
    etc...
    

    Notes: The key to it is the & param which tells the external diff command to run in a background task so files are processed immediately. In the case of BeyondCompare this opens one screen with each file in its own tab.