Why do I need to press q at the end of git log

git log -n 20 --pretty=oneline 

I tell git that I only need to see the last 20 commits. I don't like to hit Q to get rid of END. Is there a way out, so I don't need to hit q.

+73
git
Mar 02 '10 at 16:56
source share
6 answers

Git automatically displays output for you, since logs tend to easily overflow one terminal window size (you are in one of the rare exceptions - the online format and a small commit limit). If you do not want this, use:

 git --no-pager log -n 20 --pretty=oneline 

Please note that this means that you will get some ugly packaging because the pager previously turned off the packaging for you (since you could use the arrow keys to scroll left and right).

+76
Mar 02 '10 at 17:08
source share

You can disable git paging by using cat instead. After that, you can bring the result to a smaller one when you need paging, or a head if you just want to see the top, etc.

 git config --global core.pager cat 

I turn off automatic paging because I often run git from emacs, which is not needed and does not play well with less.

+20
Mar 02
source share

less accepts -F to automatically exit if content matches one screen

+11
Mar 02 '10 at 17:36
source share

git log -n 20 --pretty=oneline | cat

slightly shorter than the --no-pager option, but will also remove any colors.

+9
Mar 02
source share

If you want to use --no-pager in an alias, configure your alias as follows:

 hist = !git --no-pager log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short 
+8
Dec 05
source share

q is used to close the command line program used to view logs ... you can use another log viewer like gitk

 gitk -n 20 
0
Mar 02 '10 at 17:05
source share



All Articles