git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git: add -N as a short option for --no-pager

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 24, 2018, 16:59 UTC
Message-ID
<d91e98a8-7801-a3de-3865-f0480e18ba0e@kdbg.org>

In modern setups, less, the pager, uses alternate screen to show the content. When it is closed, it switches back to the original screen, and all content is gone.

It is not uncommon to request that the output remains visible in the terminal. For this, the option --no-pager can be used. But it is a bit cumbersome to type, even when command completion is available. Provide a short option, -N, to make the option easier accessible.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 Documentation/git.txt | 3 ++-
 git.c                 | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 4767860e72..17b50b0dc6 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
     [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
-    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
+    [-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
     [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
     [--super-prefix=<path>]
     <command> [<args>]
@@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
 	configuration options (see the "Configuration Mechanism" section
 	below).
 
+-N::
 --no-pager::
 	Do not pipe Git output into a pager.
 
diff --git a/git.c b/git.c
index ceaa58ef40..9e2d78f442 100644
--- a/git.c
+++ b/git.c
@@ -7,7 +7,7 @@
 const char git_usage_string[] =
 	N_("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n"
 	   "           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
-	   "           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n"
+	   "           [-p | --paginate | -N | --no-pager] [--no-replace-objects] [--bare]\n"
 	   "           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
 	   "           <command> [<args>]");
 
@@ -81,7 +81,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 			exit(0);
 		} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
 			use_pager = 1;
-		} else if (!strcmp(cmd, "--no-pager")) {
+		} else if (!strcmp(cmd, "-N") || !strcmp(cmd, "--no-pager")) {
 			use_pager = 0;
 			if (envchanged)
 				*envchanged = 1;
-- 
2.17.0.69.g0c1d01d9b6
Next: Junio C Hamano
Message 1 of 14 in “git: add -N as a short option for --no-pager”
  1. git: add -N as a short option for --no-pagerJohannes Sixt, Apr 24, 2018
  2. Junio C HamanoApr 25, 2018
  3. Beat Bolli <bbolli@ewanet.ch>Apr 25, 2018
  4. Johannes SixtApr 25, 2018
  5. Johannes SchindelinApr 25, 2018
  6. Johannes SixtApr 25, 2018
  7. Kaartic SivaraamMay 1, 2018
  8. Phillip WoodApr 25, 2018
  9. Johannes SixtApr 25, 2018
  10. Kaartic SivaraamMay 1, 2018
  11. git: add -P as a short option for --no-pagerJohannes Sixt, May 3, 2018
  12. Eric SunshineMay 3, 2018
  13. Junio C HamanoMay 4, 2018
  14. Johannes SchindelinDec 21, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.