0

So if I'm using Git mostly in the console and less as my core.pager, how can I make it so that whatever comes out stays in the console, with new prompt lines simply appended ? That way I can easily copy/paste outputs of less for future commands.

In this example, I find that some preprocessor has been set to a different value in the last commit, and I want to search the git history of both the former and the new value.

Currently after everything my console looks like this :

user@computer MINGW64 /c/repos/repo1
$ git diff HEAD^..HEAD

user@computer MINGW64 /c/repos/repo1
$ git log HEAD^ -G REMOTE_INTERFACES
<no output, no git history on this before the last commit>

user@computer MINGW64 /c/repos/repo1
$ git log HEAD^ -G LOCAL_INTERFACES
<some past commit has activity on this>

with a separate screen showing me the result of the first command using less :

index 1a9dae3f5..a85e787b4 100644
--- a/main.c
+++ b/dmain.c
@@ -15,7 +15,7 @@
 #include "functions.h"

-#define AUTO_INTERFACES LOCAL_INTERFACES
+#ifndef AUTO_INTERFACES REMOTE_INTERFACES

 #include "interfaces.h"

This screen is exited by pressing q and we return to the console. What I want is this :

user@computer MINGW64 /c/repos/repo1
$ git diff HEAD^..HEAD
diff --git a/main.c b/main.c
index 1a9dae3f5..a85e787b4 100644
--- a/main.c
+++ b/dmain.c
@@ -15,7 +15,7 @@
 #include "functions.h"

-#define AUTO_INTERFACES LOCAL_INTERFACES
+#ifndef AUTO_INTERFACES REMOTE_INTERFACES

 #include "interfaces.h"

user@computer MINGW64 /c/repos/repo1
$ git log HEAD^ -G REMOTE_INTERFACES
<no output, no git history on this before the last commit>

user@computer MINGW64 /c/repos/repo1
$ git log HEAD^ -G LOCAL_INTERFACES
<some past commit has activity on this>
Charles
  • 988
  • 1
  • 11
  • 28
  • Try option [`-X`](https://linux.die.net/man/1/less) (uppercase). `export LESS=X` or `export LESS=${LESS}X` in Bash, `set LESS=X` or `set LESS=%LESS%X` in cmd. – phd Mar 17 '22 at 16:17
  • 1
    As @phd said, use `-X` to disable the screen-flipping. I *hate* the screen-flipping and disable it in my termcap/terminfo wherever I can. It's very annoying that the default Terminal software on macOS does not have a disable checkbox (you can disable these with an inhibit flag on some terminal emulators so that the termcap/terminfo/hardcoded ti/te sequences have no effect, which is also good enough, but not so in Terminal...). – torek Mar 18 '22 at 00:04

0 Answers0