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

GitCommand LineTerminal

Git Problem Overview


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

Git Solutions


Solution 1 - Git

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

Solution 2 - Git

:q

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

Solution 3 - Git

Type 'q' and it will do the job.

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'.

Solution 4 - Git

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

Solution 5 - Git

for windows :

Ctrl + q and c for exit the running situation .

Solution 6 - Git

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

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

                   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> 
        ---------------------------------------------------

Solution 7 - Git

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

git config --global pager.<command> false

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

git config --global pager.log false

Solution 8 - Git

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

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

Then you can use :q

Solution 9 - Git

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

  1. CTRL + C
  2. :qa!

Solution 10 - Git

Before pressing exit commands(q, etc..) check current input language: if it isn't English commands may not work.

Solution 11 - Git

Crt + c works for Windows! user1852392

Solution 12 - Git

If you are facing this?

enter image description here Sometimes it is possible that while writing in Gitbash you get into > and you just can not get out of that.
It happens with me quite often while I type ' by mistake in Gitbash(See in the image).

How to solve this in Mac?

> control + C

I have not checked it in Windows. But if it does please edit that in my answer.

Solution 13 - Git

In Linux Terminal

After git diff typing

 :q 

you can exit from screen showing changes accross pages.

After you performed merge your project from remote or pull updates from remote

ctrl + x

Solution 14 - Git

If you are on the git bash try using exit;

I tried using the q or ctrl + q but they did not worked on bash.

Solution 15 - Git

[try this and see the image too]

I tried other methods but didnt work. I just put 'cd ../' and it worked

codes: >>zsh: command not found: Q

$(virtual) ➜ ML git:(master) quit >>zsh: command not found: quit

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

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

Solution 16 - Git

exit did it for me. My results after pressing return;

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLuis MartinsView Question on Stackoverflow
Solution 1 - GitCarl SmotriczView Answer on Stackoverflow
Solution 2 - GitRageZView Answer on Stackoverflow
Solution 3 - GitallesklarView Answer on Stackoverflow
Solution 4 - GitSovietFrontierView Answer on Stackoverflow
Solution 5 - Gitgem007bdView Answer on Stackoverflow
Solution 6 - GitBlake RegaliaView Answer on Stackoverflow
Solution 7 - GitJames MorganView Answer on Stackoverflow
Solution 8 - GitJamaniusView Answer on Stackoverflow
Solution 9 - GitMd. Rejaul KarimView Answer on Stackoverflow
Solution 10 - GitpapandreusView Answer on Stackoverflow
Solution 11 - GitPythonLearnerView Answer on Stackoverflow
Solution 12 - GitRohit SinghView Answer on Stackoverflow
Solution 13 - GitinfomasudView Answer on Stackoverflow
Solution 14 - GitGovinView Answer on Stackoverflow
Solution 15 - GitroseView Answer on Stackoverflow
Solution 16 - GitRonny KView Answer on Stackoverflow