I'm trying to learn Git with the help of Git Immersion.
There's one thing that frustrates me whenever I use git log
or git diff
:
I can't figure out what to do next when I encounter this (END)
word.
I can't type any commands, and I end up closing the current Bash window and open another. How do I type in the next command that I want to use?
Actually, there are three ways to do it, precisely.
Type any of the following 3 commands.
P.S.: Sometimes, for someone, one of these options doesn't seem to work and for others it works.
Add following alias in the .bashrc file
git --no-pager log --oneline -n 10
--no-pager
will encounter the (END) word-n 10
will show only the last 10 commits--oneline
will show the commit message, ignore the author, date informationYou can press q to exit.
git hist
is using a pager tool so you can scroll up and down the results before returning to the console.
The END
comes from the pager used to display the log (your are at that moment still inside it). Type q to exit it.
In this case, as snarly suggested, typing q is the intended way to quit git log
(as with most other pagers or applications that use pagers).
However normally, if you just want to abort a command that is currently executing, you can try ctrl+c (doesn't seem to work for git log
, however) or ctrl+z (although in bash, ctrl-z will freeze the currently running foreground process, which can then be thawed as a background process with the bg
command).
I wanted to give some kudos to the comment that mentioned CTRL + Z as an option. At the end of the day, it's going to depend on what system that you have Git installed on and what program is configured to open text files (e.g. less vs. vim). CTRL + Z works for vim on Windows.
If you're using Git in a Windows environment, there are some quirks. Just helps to know what they are. (i.e. Notepad vs. Nano, etc.).
Source: Stackoverflow.com