★ git: --no-pager
• 212 words • 1 min • updated
Let’s say you use color highlighting to visually inspect diffs with git, such
as delta or
diff-highlight
or diffr.
Implication: whenever you run git diff, git show, or any other git
command that produces a diff, it will emit colors (typically red and green).
Colors are great for local visual inspection, but they are terrible for sharing. They won’t be carried over with copy-and-paste.
If you intend to share diff output (e.g. to a Q&A site, with teammates), it’s
better to emit - and +, as vanilla diff does.
The easiest way to do so is to pass --no-pager to git:
git --no-pager diff a83bc395
git --no-pager show HEADFor example, a recent commit in my dotfiles:
% git --no-pager show HEAD~1
commit 52b1e91b0f1d93176ec768aa6158974fc401f335
Author: Thiago Perrotta <{redacted}>
Date: Thu Aug 7 12:00:47 2025 +0200
fix mr
diff --git bin/.bin/sd-world bin/.bin/sd-world
index c46be0e..44c0b47 100755
--- bin/.bin/sd-world
+++ bin/.bin/sd-world
@@ -58,7 +58,7 @@ esac
run_if_exists "claude" claude update
# myrepos
-run_if_exists "mr" mr -d ~ update
+(cd ~ && run_if_exists "mr" mr update)
# source corp updates if any
run_if_exists "sd-world-corp"Note that --no-pager is a git-level option: it should be specified before
the git subcommand. The following does not work:
% git show HEAD~1 --no-pager
fatal: unrecognized argument: --no-pagerBacklinks
- git delta (Jun 16, 2025)