I've got Git for Windows setup (msysgit) and it was working fine for the last few days and today I've encountered an odd error.
When issuing a Git command in the Windows Command Prompt or in the Git Bash that comes bundled with msysgit, I get a strange '(END)' line appear and then I cannot issue any other comamnds.
At this point all I get are syste开发者_如何学运维m beeps.
Any ideas?
Thanks, P.
Git want to show more than one screen of information to you, to do so it call the standard unix pager program less
. Just type q to return to the prompt when you no longer want to navigate in the output.
- j move one line down
- k move one line up
- <space> move one page down
- b move one page up
- h show the help
If you want to use git efficiently you should learn the basic unix tools. Even if git build and run on windows it's pretty much an alien software on the platform.
If you don't want less
just replace it with another pager in the configuration. If you don't want a pager at all just use cat
:
git config --global --add core.pager cat
Press q to exit the pager (which is less
in git by default).
I first came across this question when I was looking for the same thing; to not have to exit out of the log command. I have since found the answer I like, so even though it is well after the original asking I will add this answer to provide an additional solution that I didn't find quickly in my own search.
Others have stated why the (END)
is present -- the results are being piped thru a pager, one that can be configured for a different pager.
However, I sometimes don't want it to stop at all; because I've specified other options that do the limiting. I found that for this git has a global option --no-pager
to turn off the whatever pager is defined in the config file.
This global option is on the git
command itself, is available for all subcommands and is placed before the subcommand like this:
git --no-pager log
Git is using the "pager" called less
, which allows you to scroll through large amount of program output easily. However, the default settings on Git for Windows seem to be to keep the pager running even when there is less than one screen of output.
Here is the default setting I had before, which would always show the (END)
and wait for you to hit q
before returning you to your prompt:
$ git config --get core.pager
less -+F
You can change the behavior so that less
will only keep running (and take control of the keyboard) when there is more than a screenful of output by changing the option to -F
instead of -+F
.
Fix the pesky pager with
$ git config --global core.pager "less -F"
(The -+X
option syntax for less is documented to reset the -X
option to its "default", although that is not the behavior I observed with -+F
since removing the option altogether was equivalent to -F
, not -+F
.)
精彩评论