diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-11-15 10:14:10 -0500 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2021-11-15 10:14:10 -0500 |
commit | ba446070223873487e25197ff39af9997bc4da28 (patch) | |
tree | 16331c97e833cd0c528c2e059a2e2b0a0a931f01 | |
parent | 00768743df14aeac2682555c694d9133509e59d1 (diff) |
Doc: explain invocation of delta by git
-rw-r--r-- | README.md | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -323,9 +323,15 @@ Delta also handles unified diff format, e.g. `diff -u a.txt b.txt | delta`. For Mercurial, you can add delta, with its command line options, to the `[pager]` section of `.hgrc`. -#### Environment +#### How delta works + +If you configure delta in gitconfig as above, then git will automatically send its output to delta. +Delta in turn passes its own output on to a "real" pager. +Note that git will only send its output to delta if git believes that its output is going to a terminal (a "tty") for a human to read. +In other words, if you do something like `git diff | grep ...` then you don't have to worry about delta changing the output from git, because delta will never be invoked at all. +If you need to force delta to be invoked when git itself would not invoke it, then you can always pipe to delta explicitly. +For example, `git diff | delta | something-that-expects-delta-output-with-colors` (in this example, git's output is being sent to a pipe, so git itself will not invoke delta). -Delta acts as a pager for git's output, and delta in turn passes its own output on to a "real" pager. The pager that delta uses is determined by consulting the following environment variables (in this order): - `DELTA_PAGER` |