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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1696433/
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-10 07:19:19  来源:igfitidea点击:

How to exit a 'git status' list in a terminal?

gitcommand-lineterminal

提问by Luis Martins

I'm new to Git and the terminal. How can I exit a listing mode generated by the git statuscommand?

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

回答by Carl Smotricz

I have to guess here, but git is probably running its output into your $PAGER program, likely lessor more. In either case, typing qshould get you out.

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

回答by RageZ

:q

that's a lesscommand, actually. It uses the same commands as vi.

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

回答by allesklar

Type 'q' and it will do the job.

输入“q”,它就会完成这项工作。

Whenever you are at the terminal and have a similar predicament keep in mind also to try and type 'quit', 'exit' as well as the abort key combination 'Ctrl + C'.

每当您在终端遇到类似的困境时,请记住尝试输入“退出”、“退出”以及中止组合键“Ctrl + C”。

回答by gem007bd

for windows :

对于窗户:

Ctrl + q and c for exit the running situation .

Ctrl+q 和 c 退出运行状态。

回答by SovietFrontier

qor SHIFT+qwill do the trick. This will get you out of many extensive page scrolling sessions like git status, git show HEAD, git diffetc. This will not exit your window or end your session.

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

回答by Blake Regalia

My preferred combo is Gq, which prints all diffs and then exits.

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

You can type hto show the help commands for interacting with less, which prints this to console:

您可以键入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> 
        ---------------------------------------------------

回答by Jamanius

first of all you need to setup line ending preferences in termnial

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

git config --global core.autocrlf input
git config --global core.safecrlf true

Then you can use :q

然后你可以使用 :q

回答by James Morgan

You can disable pager for commands that don't recognize --no-pagerflag.

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

git config --global pager.<command> false

I disable for log aliases and set specific quantity to return.

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

git config --global pager.log false

回答by PythonLearner

Crt + c works for Windows! user1852392

Crt + c 适用于 Windows!用户1852392

回答by Md. Rejaul Karim

Please try this steps in git bash, It may help you.

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

  1. CTRL + C
  2. :qa!
  1. CTRL + C
  2. :qa!