Git core pager less : leaving text in the console

203 views Asked by At

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

There are 0 answers