在单独的终端屏幕上显示git diff和git log输出 [英] Displaying git diff and git log output on a separate terminal screen

查看:320
本文介绍了在单独的终端屏幕上显示git diff和git log输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置新的开发环境后,我遇到了一个奇怪的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.

请参阅我的答案. >如何在同一CLI终端上在屏幕上显示git branch的输出?.请注意,您也可以选择要使用的寻呼机和/或是否使用寻呼机. (好吧,您在问题中注意到了这一点.)

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆