Menu

Toshimaru's Blog

Using git without a pager

Git employs a pager when you run commands like git diff, git show, git grep, etc.

If you prefer to view the results without a pager, simply add --no-pager or -P.

--no-pager option

$ git --no-pager diff
diff --git a/Gemfile b/Gemfile
index b413366f..9d9b8837 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,3 +1,5 @@
+# This is test diff
+
 source 'https://rubygems.org'

 gem 'jekyll', '~> 4.2'
...snip...

-P option

$ git -P grep Toshimaru
_config.yml:title: "Toshimaru's Blog"
_layouts/default.html:      <link type="application/atom+xml" rel="alternate" href="https://blog.toshima.ru/feed/by_tag/Using git without a pager.xml" title="Tag: Using git without a pager - Toshimaru's Blog" />
_layouts/default.html:      © Toshimaru
...snip...

Reference

How do I prevent ‘git diff’ from using a pager? - Stack Overflow

Load more