47

我正在运行 gitimmersion.com 实验室,每次运行: git hist --all 命令时,它似乎都会破坏终端并抛出这个:

~
~
~
~
(完)

而且我无法再输入任何命令。所以我最终关闭了那个终端窗口并重新开始。

任何人都知道为什么会发生这种情况以及如何解决它?

谢谢!

4

2 回答 2

41

Git 默认将长输出通过管道传输到所谓的分页器中,这样可以在输出不适合屏幕的情况下更轻松地查看输出。这些~字符表示这些行不在原始输出中,但它正在显示它们,以便您可以向下滚动到底部(即最后一行输出可以到屏幕顶部)。

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


或者,如果您不希望在寻呼机中输出,请尝试以下操作:

$ git --no-pager hist --all
于 2012-06-29T11:47:22.440 回答
4

摘自git help config

  core.pager
       The command that git will use to paginate output. Can be overridden with the GIT_PAGER environment variable.
       Note that git sets the LESS environment variable to FRSX if it is unset when it runs the pager. One can
       change these settings by setting the LESS variable to some other value. Alternately, these settings can be
       overridden on a project or global basis by setting the core.pager option. Setting core.pager has no affect
       on the LESS environment variable behaviour above, so if you want to override git’s default settings this
       way, you need to be explicit. For example, to disable the S option in a backward compatible manner, set
       core.pager to less -+$LESS -FRX. This will be passed to the shell by git, which will translate the final
       command to LESS=FRSX less -+FRSX -FRX.

完全跳过寻呼机:

git config --global core.pager cat

-F标志 toless很好,因为它告诉如果less它适合一页,则不要分页输出。

于 2012-06-29T12:07:45.353 回答