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

[PATCH/RFC] "git --less cmd" to page anywhere

From
Junio C Hamano <junkio@cox.net>
Date
Jun 6, 2006, 23:58 UTC
Message-ID
<7vodx5n8en.fsf_-_@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0606041621010.5498@g5.osdl.org>
This allows you to say:
	git --less diff v2.6.16-rc5..
to pipe the output of any git command to your pager.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
  Linus Torvalds <torvalds@osdl.org> writes:
  > On Sun, 4 Jun 2006, Petr Baudis wrote:
  >> 
  >> And I forgot to mention that it also adds the interactivity test
  >> requested by Janek - aliases are now interpreted only when stdout is a
  >> tty.
  >
  > I don't think that's a good test.
  >
  > The fact is, I do
  >
  > 	git diff | less -S
  >
  > all the time,...
  This is not a serious patch, since I suspect it would obviously
  not make much sense to say "git --less commit" or somesuch,
  but it was fun to do.
 git.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/git.c b/git.c
index bc463c9..c52da8c 100644
--- a/git.c
+++ b/git.c
@@ -10,6 +10,7 @@ #include <limits.h>
 #include <stdarg.h>
 #include "git-compat-util.h"
 #include "exec_cmd.h"
+#include "cache.h"
 
 #include "builtin.h"
 
@@ -162,6 +163,10 @@ int main(int argc, const char **argv, ch
 			puts(git_exec_path());
 			exit(0);
 		}
+		if (!strcmp(cmd, "less")) {
+			setup_pager();
+			continue;
+		}
 		cmd_usage(0, NULL, NULL);
 	}
 	argv[0] = cmd;
Previous: Linus TorvaldsNext: Linus Torvalds
Message 7 of 12 in “Support for configurable git command aliases (v2)”
  1. Support for configurable git command aliases (v2)Petr Baudis, Jun 4, 2006
  2. Petr BaudisJun 4, 2006
  3. Martin MaresJun 4, 2006
  4. Petr BaudisJun 4, 2006
  5. Junio C HamanoJun 4, 2006
  6. Linus TorvaldsJun 4, 2006
  7. "git --less cmd" to page anywhereJunio C Hamano, Jun 6, 2006
  8. Linus TorvaldsJun 7, 2006
  9. Petr BaudisJun 7, 2006
  10. Linus TorvaldsJun 7, 2006
  11. Martin LanghoffJun 7, 2006
  12. Linus TorvaldsJun 7, 2006

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.