在单独的终端屏幕上显示git diff和git log输出 [英] Displaying git diff and git log output on a separate terminal screen
问题描述
设置新的开发环境后,我遇到了一个奇怪的git行为,我不记得以前看到过.
After setting up new development environment I encountered a strange git behavior that I don't recall seeing in the past.
我习惯于git diff and git log
在终端中创建一个新屏幕并在其内部显示其输出(默认情况下 less 会做什么,并且我将其用作寻呼机).
I am used to git diff and git log
creating a new screen in the terminal and displaying their output inside (what less does by default, and I'm using it as my pager).
然后我可以退出并返回到先前的终端状态,命令输出消失了.但是,现在,输出将被直接打印到与 cat 相同的屏幕上(但使用寻呼机).任何想法如何解决这一问题?找不到在线任何信息.
I can then quit and go back to my previous terminal state, with the command output gone. Now, however, output is printed right into the same screen as if it was cat (but with a pager). Any ideas how to fix this? Couldn't find any info online.
更新:
通过将core.pager
设置为'less -+F -+X'
UPDATE:
Was able to fix this with @torek's help by setting core.pager
to 'less -+F -+X'
推荐答案
您以前可能已将less
设置为使用-X
,而以前您已将less
设置为 not 使用-X
.
You probably have less
set to use -X
now, when you previously had less
set not to use -X
.
请参阅
See my answer to How to display output of `git branch` on-screen in same CLI terminal?. Note that you can choose which pager to use, and/or whether to use a pager, too. (Well, you noted this in your question.)
这篇关于在单独的终端屏幕上显示git diff和git log输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!