如何退出终端中的“git status”列表?

时间:2009-11-08 13:15:48

标签: git command-line terminal

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

15 个答案:

答案 0 :(得分:432)

我必须在这里猜测,但是git可能会将其输出运行到您的$ PAGER程序中,可能是lessmore。在任何一种情况下,输入 q 都可以让你出局。

答案 1 :(得分:139)

:q
实际上,这是一个less命令。它使用与vi相同的命令。

答案 2 :(得分:99)

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

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

答案 3 :(得分:12)

for windows:

Ctrl + q和c退出运行情况。

答案 4 :(得分:5)

首先,您需要在终端

中设置行结束首选项
git config --global core.autocrlf input
git config --global core.safecrlf true

然后您可以使用:q

答案 5 :(得分:5)

我首选的组合是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> 
        ---------------------------------------------------

答案 6 :(得分:3)

在按下退出命令(q等)之前,请检查当前输入语言:如果不是,则英语命令可能无效。

答案 7 :(得分:3)

Crt + c适用于Windows! user1852392

答案 8 :(得分:2)

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

git config --global pager.<command> false

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

git config --global pager.log false

答案 9 :(得分:2)

q SHIFT + q 可以解决问题。这将使您脱离许多广泛的页面滚动会话,例如git statusgit show HEADgit diff等。这不会退出窗口或结束会话。

答案 10 :(得分:1)

是否要面对这个问题?

enter image description here 有时,使用Gitbash编写代码时,您可能会进入>而又无法摆脱。
当我在Gitbash中错误输入'时,这种情况经常发生在我身上(见图)。

如何在Mac中解决此问题?

  

control + C

我没有在Windows中检查它。但是,如果确实如此,请在我的答案中进行编辑。

答案 11 :(得分:0)

如果你在git bash上尝试使用exit;

我尝试使用q或ctrl + q,但它们没有用于bash。

答案 12 :(得分:0)

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

  1. CTRL + C
  2. :qa!

答案 13 :(得分:0)

[试试这个,也看看图片]

我尝试了其他方法但没有奏效。我只是把'cd ../' 它奏效了

代码:

<块引用> <块引用>

zsh:找不到命令:Q

$(virtual) ➜ ML git:(master) 退出

<块引用> <块引用>

zsh:找不到命令:退出

$(virtual) ➜ ML git:(master)quit()

<块引用> <块引用>

功能>

$(virtual) ➜ ML git:(master) cd ../

<块引用> <块引用>

(虚拟)➜ 最终

答案 14 :(得分:-3)

exit为我做了。 按下返回后的结果;

my-mac:Car Game mymac$ exit
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
    ...completed.
[Process completed]