如何退出终端中的git状态列表?

Lui*_*ins 308 git terminal command-line

我是Git和Terminal的新手.如何退出git status命令生成的列表模式?

Car*_*icz 459

我必须在这里猜测,但是git可能正在将其输出运行到你的$ PAGER程序中,可能less还是more.无论哪种情况,打字q都应该让你出局.

  • git使用的寻呼机由`core.pager`配置变量(如果已设置),然后是GIT\_PAGER环境变量,然后是PAGER环境变量,然后是'less`作为后备. (10认同)
  • 谢谢!这是来自宙斯的礼物。您刚刚为谷歌搜索节省了一个小时。 (3认同)
  • 再次感谢,我大多数时候都从头开始。我也是新手。 (2认同)

Rag*_*geZ 145

:q
Run Code Online (Sandbox Code Playgroud)

实际上,这是一个较少的命令.它使用与vi相同的命令.

  • 如果它更少,则不需要冒号(:).你在想vi! (9认同)
  • 他们不喜欢我... =) (4认同)
  • 如果出现** E37:自上次更改以来没有写入错误(添加!以覆盖)**错误,请执行其指示并使用`:q!`。 (2认同)

all*_*lar 101

输入'q'即可完成工作.

每当你在终端并有类似的困境时,请记住尝试输入'退出','退出'以及中止键组合'Ctrl + C'.

  • 当我运行```ps -ax```时,我正在使用'Ctrl + Z'并结束了大量未终止的git进程.不知道```q```. (4认同)
  • Ctrl + Z将任务放在后台,因此很有意义。我个人无法使用Ctrl + C来关闭它。q有效。 (2认同)

小智 13

对于Windows:

按Ctrl + q和c退出运行情况.


inf*_*sud 8

在 Linux 终端中

git diff 打字后

 :q 
Run Code Online (Sandbox Code Playgroud)

您可以退出显示跨页面更改的屏幕。

从远程合并项目或从远程提取更新后

ctrl + x
Run Code Online (Sandbox Code Playgroud)


Sov*_*ier 7

qSHIFT+ q可以解决问题。这将让你们出去,如同许多丰富的页面滚动会话git statusgit show HEADgit diff等,这将不会退出你的窗口或结束会话。


Bla*_*lia 6

我首选的组合是Gq,它会打印所有差异,然后退出。

您可以键入h以显示与less进行交互的帮助命令,并将其打印到控制台:

                   SUMMARY OF LESS COMMANDS

      Commands marked with * may be preceded by a number, N.
      Notes in parentheses indicate the behavior if N is given.

  h  H                 Display this help.
  q  :q  Q  :Q  ZZ     Exit.
 ---------------------------------------------------------------------------

                           MOVING

  e  ^E  j  ^N  CR  *  Forward  one line   (or N lines).
  y  ^Y  k  ^K  ^P  *  Backward one line   (or N lines).
  f  ^F  ^V  SPACE  *  Forward  one window (or N lines).
  b  ^B  ESC-v      *  Backward one window (or N lines).
  z                 *  Forward  one window (and set window to N).
  w                 *  Backward one window (and set window to N).
  ESC-SPACE         *  Forward  one window, but don't stop at end-of-file.
  d  ^D             *  Forward  one half-window (and set half-window to N).
  u  ^U             *  Backward one half-window (and set half-window to N).
  ESC-)  RightArrow *  Left  one half screen width (or N positions).
  ESC-(  LeftArrow  *  Right one half screen width (or N positions).
  F                    Forward forever; like "tail -f".
  r  ^R  ^L            Repaint screen.
  R                    Repaint screen, discarding buffered input.
        ---------------------------------------------------
        Default "window" is the screen height.
        Default "half-window" is half of the screen height.
 ---------------------------------------------------------------------------

                          SEARCHING

  /pattern          *  Search forward for (N-th) matching line.
  ?pattern          *  Search backward for (N-th) matching line.
  n                 *  Repeat previous search (for N-th occurrence).
  N                 *  Repeat previous search in reverse direction.
  ESC-n             *  Repeat previous search, spanning files.
  ESC-N             *  Repeat previous search, reverse dir. & spanning files.
  ESC-u                Undo (toggle) search highlighting.
        ---------------------------------------------------
        Search patterns may be modified by one or more of:
        ^N or !  Search for NON-matching lines.
        ^E or *  Search multiple files (pass thru END OF FILE).
        ^F or @  Start search at FIRST file (for /) or last file (for ?).
        ^K       Highlight matches, but don't move (KEEP position).
        ^R       Don't use REGULAR EXPRESSIONS.
 ---------------------------------------------------------------------------

                           JUMPING

  g  <  ESC-<       *  Go to first line in file (or line N).
  G  >  ESC->       *  Go to last line in file (or line N).
  p  %              *  Go to beginning of file (or N percent into file).
  t                 *  Go to the (N-th) next tag.
  T                 *  Go to the (N-th) previous tag.
  {  (  [           *  Find close bracket } ) ].
  }  )  ]           *  Find open bracket { ( [.
  ESC-^F <c1> <c2>  *  Find close bracket <c2>.
  ESC-^B <c1> <c2>  *  Find open bracket <c1> 
        ---------------------------------------------------
Run Code Online (Sandbox Code Playgroud)


小智 5

首先,您需要在termnial中设置行结束首选项

git config --global core.autocrlf input
git config --global core.safecrlf true
Run Code Online (Sandbox Code Playgroud)

然后你可以使用 :q


小智 5

您可以为无法识别--no-pager标志的命令禁用寻呼机。

git config --global pager.<command> false
Run Code Online (Sandbox Code Playgroud)

我禁用日志别名并设置要返回的特定数量。

git config --global pager.log false
Run Code Online (Sandbox Code Playgroud)


Md.*_*rim 5

请在 git bash 中尝试此步骤,它可能对您有所帮助。

  1. CTRL + C
  2. :qa!