68

I'm running through the gitimmersion.com labs and every time I run a: git hist --all command it seems to break terminal and throw this:

~
~
~
~
(END)

and I'm not able to type any more commands. So I end up closing that terminal window and starting over.

Anyone know why this happens and how to resolve it?

Thanks!

3
  • 117
    type q to get out of there.
    – CharlesB
    Jun 29, 2012 at 11:40
  • 1
    git hist is not a command, did you mean git log?
    – CharlesB
    Jun 29, 2012 at 11:41
  • 2
    In the git immersion tutorial he aliases git hist to git log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short.
    – vergenzt
    Jun 29, 2012 at 11:51

3 Answers 3

60

Git pipes long output into what's called a pager by default, which can make it easier to view the output if it doesn't fit on a screen. The ~ characters indicate that those lines were not in the original output, but it's showing them so that you can scroll down past the bottom (i.e. the last line of output can go up to the top of the screen).

You typically can use the arrow keys to scroll up or down, and can exit by pressing q.


Alternatively, if you don't want the output in a pager, try this:

$ git --no-pager hist --all
4
  • 1
    q did it! Thanks to all that commented that. I'll have to try to see if i can add the --no-pager to my .gitconfig file as part of the alias.
    – sigmapi13
    Jun 29, 2012 at 16:19
  • @Fredrik had the solution to that, you don't have to add it to an alias, unless you want to disable the pager for just that command. If you want it off globally (or for the repository), do git config [--global] core.pager cat.
    – vergenzt
    Jun 29, 2012 at 17:46
  • How to do the same for Github cli? I am trying to use gh -R myorg/myrepo issue list --assignee "@me" to list all issues assigned to me but this is breaking my terminal with END aswell, and once i quit with q, i am losing the output
    – anandhu
    Nov 6, 2022 at 7:30
  • @anandhu to disable paging for the Github cli, you can either permanently disable it by setting gh's pager setting to cat, or you can disable it for one-off calls by adding PAGER=cat to the beginning of the individual command line -- e.g. PAGER=cat gh -R myorg/myrepo issue list --assignee "@me".
    – vergenzt
    Jan 9, 2023 at 14:51
6

Taken from 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.

To skip a pager completely:

git config --global core.pager cat

The -F flag to less is nice as it tells less to not page the output if it fits on one page.

1

Just in case someone still needs this, today once you reach the (end) mark in any terminal operation simply hitting the "q" button on your keyboard would take you out of there instead of of closing down your terminal and maybe reopening it again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.