gitdiffgit-configgit-difftool

Reset external diff tool per command


I've recently installed a new diff tool (difftastic), which messes with my habit of copying diffs to clipboard (or to file) to send those:

[diff]
    external = difft # As per https://difftastic.wilfred.me.uk/git.html
                                | what I want | what I get |
                                | ----------- | ---------- |
$ git diff                      | difft       | difft      |
$ git diff > some-file          | git diff    | difft      |
$ GIT_EXTERNAL_DIFF= git diff   | git diff    | error      |

My end goal is to have a single command to which I can pass usual git diff arguments and get the original (something like git diff --internal basically.

Eventually I'll go upstream to difftastic and offer a PR fixing that (e.g. difftastic defaulting to using git if piped), but I'm almost certain I don't understand correctly git's diff.external and difftool* configs. And I don't know how to reset diff.external per command


Solution

  • A partial solution I found thanks to matt's comments on the question:

    git diff --no-ext-diff
    

    Yet I'm sure there are cleaner solution to better choose between either git diff is piped, hence use normal patch or git diff isn't hence do the fancy thing.