简体   繁体   English

使用git log后如何进入Git Bash中的下一个命令?

[英]How do I go to the next command in Git Bash after using git log?

When using Git Bash, I type the command: 使用Git Bash时,我输入命令:

git log

It shows me all the logs. 它显示了所有日志。 But now I want to do a second command. 但现在我想做第二个命令。 So I hold the down arrow to get to the bottom of the logs and it just says (END) . 所以我按住向下箭头到达日志的底部,它只是说(END) How do I get to the next line so I can enter my next command? 如何进入下一行,以便输入下一个命令?

By default, Git commands that display a lot of information will show the information through a different program, called terminal pager . 默认情况下,显示大量信息的Git命令将通过另一个程序(称为终端寻呼机)显示信息。 These programs basically show you the information in pages, so that you can see everything and not only the very last bit of information at the end. 这些程序基本上向您显示页面中的信息,这样您就可以看到所有内容,而不仅仅是最后的最后一点信息。

The most known pagers include more and less . 最知名的寻呼机包括more less

Git for Windows comes bundled with less and is configured to use that by default. Git for Windows捆绑了less ,默认情况下配置为使用它。 Less gives you the ability to scroll up and down the output (using your arrow keys), so you can browse for as long as you want. Less使您能够向上和向下滚动输出(使用箭头键),因此您可以根据需要浏览。 In order to exist the program, you need to press the q key on your keyboard. 要存在该程序,您需要按键盘上q This will put you back into bash. 这会让你重新陷入bash。

You can change the paging behavior of Git by configuring the core.pager configuration . 您可以通过配置core.pager配置来更改Git的分页行为。

to quit form the git log you need to type q . 要退出你需要输入q的git日志。

If you want to "limit" the log entries : 如果要“限制”日志条目:

# display only the first X entries form the log.
# This way you will not have the pager so mo need to quit from the pager
git log -n <number of commits>

If you want to run multiple commands use the &&: 如果要运行多个命令,请使用&&:

git log -n 10 && git status

--no-pager

--no-pager will disable the pager got the given command. --no-pager将禁用寻呼机获得给定命令。

git --no-pager log  ...
git --no-pager diff ...

Git by default will page to less. 默认情况下,Git会减少页面。

Less can be quit by pressing q or by pressing Ctrl + c q或按Ctrl + c可以退出减少

You can use B and F for backward/forward navigation in git bash results. 您可以在git bash结果中使用BF进行向后/向前导航。

Also using the Space on the keyboard also works for the forward movement. 使用键盘上的Space也适用于向前移动。

You can quit the resuls and get back to promp, using Q . 您可以退出结果并使用Q

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM