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 ''

 gem 'jekyll', '~> 4.2'

-P option

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


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

Load more