1. 1 year ago

    What’s the Diff?

    Normally, to see the differences in a file managed by git, I do this:

       git diff <file>

    And the output at the commandline looks about like this:

    diff --git a/README b/README
    index 37ec8ea..1cdd33d 100644
    --- a/README
    +++ b/README
    @@ -24,6 +24,7 @@ more separate. Each of these packages can be used independently outside of
     Rails.  You can read more about Action Pack in
     link:files/vendor/rails/actionpack/README.html.
     
    +Testing
     
     == Getting Started

    Instead of diff, you can use difftool (with git 1.6.3 or above) for a nice diff GUI.

       git difftool <file>

    By default that’ll bring up a text prompt asking you to chose from a selection of different diff GUI’s. The default choice, opendiff, is mapped to Apple’s FileMerge on the Mac. It’s a competent, though not a stellar option. Here is a discussion on diff GUIs for Mac. One of the nicer options is Changes.

    If you add a new GUI that’s not in git’s existing list of choices, you’ll need to “teach” git about the new tool options. Here’s an example for Changes:

       git config —global difftool.chdiff.cmd ‘chdiff “$LOCAL” “$REMOTE”’

    Once you’ve decided which GUI you’ll use, the prompting will get annoying. You can default your choice and avoid the prompt with:

       git config —global diff.tool “chdiff”

       git config —global difftool.prompt false

    git

    diff