git branch ~(END) 在终端上?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51015733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:09:01  来源:igfitidea点击:

git branch ~(END) on terminal?

gitcommand-lineterminal

提问by Brian Park

To note, I'm on Oh-My-Zsh and git 2.17. Whenever I type in git branch, instead of showing me the branches of my git, it shows something like this:

请注意,我使用的是 Oh-My-Zsh 和 git 2.17。每当我输入 git branch 时,它不会显示我的 git 分支,而是显示如下内容:

~
~
~
~
~
(END)

I can quit this by pressing 'q' on my keyboard, but I'm still confused as to why this is appearing.

我可以通过按键盘上的“q”来退出它,但我仍然不明白为什么会出现这种情况。

回答by Gary Mendonca

Git pipes long output into what's called a pager by default, which can make it easier to view the output if it doesn't fit on a screen. The ~ characters indicate that those lines were not in the original output, but it's showing them so that you can scroll down past the bottom (i.e. the last line of output can go up to the top of the screen).

默认情况下,Git 将长输出传送到所谓的寻呼机中,如果输出不适合屏幕,则可以更轻松地查看输出。~ 字符表示这些行不在原始输出中,但它显示它们以便您可以向下滚动到底部(即输出的最后一行可以上升到屏幕顶部)。

You typically can use the arrow keys to scroll up or down, and can exit by pressing q.

您通常可以使用箭头键向上或向下滚动,并可以按 q 退出。

回答by Fred

You can replace the pager with lessso it doesn't "scroll" outputs less than the height of the terminal.

您可以用 替换寻呼机,less这样它就不会“滚动”输出小于终端的高度。

git config --global --replace-all core.pager "less -F -X"

git config --global --replace-all core.pager "less -F -X"

I found it from this q. Took a while to find compared to OPs questions, so I figured I'd drop it here in case anyone else has the same issue.

我是从这个 q 中找到的。与 OP 问题相比,花了一段时间才找到,所以我想我会把它放在这里,以防其他人遇到同样的问题。

https://stackoverflow.com/a/14118014/4881742

https://stackoverflow.com/a/14118014/4881742

回答by VonC

Note that:

注意: