Search code examples
gitgit-checkoutgit-diffgit-addgit-patch

How can I use my own diff tool with `add --patch` and the like?


I use an offbeat diff tool called diffr, like this:

diffr="diffr \
      --colors removed:background:00:foreground:01 \
      --colors refine-removed:background:0:foreground:124 \
      --colors added:background:0:foreground:10 \
      --colors refine-added:background:0:foreground:35:intense \
      | less -R"

git config --global pager.diff "$diffr"
git config --global pager.show "$diffr"
git config --global pager.log "$diffr"

My normal workflow also commonly makes use of the --patch and --interactive flags when adding and checking out code.

However, the --patch switch appears to use the default (colordiff?) and not diffr.

How can I coerce diffr as the diff tool in this context (and any others I may not be thinking of)?


Solution

  • Sometimes all you have to do to find the answer is ask the question.

    The solution is:

    git config --global interactive.diffFilter "$diffr"