How to include --no pager in a Git alias?

I created a Git alias based on the EdgeCase Git Immersion tutorial that looks like this:

hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short 

But now it seems to be a swap of results - the terminal shows (END) after displaying the results, forcing me to press Q to continue working. I read that by adding the --no-pager tag, you can disable this feature; How to include it in an alias? I tried this at the end, before log and right after, and none of them worked. Git throws an error saying that it is an unrecognized argument or that it modifies environment variables. Any tips?

+9
source share
3 answers

You can do this easily by simply turning it into a shell command:

 hist = "!git --no-pager log ..." 
+17
source

Note: with Git 2.18 (Q2 2018), an alias can use a shorter option for --no-Pager :
" git --no-Pager cmd " did not have a short and sweet single-letter option. Now it is.

Now the alias can be:

 hist = "!git -P log ..." 

See Commit 7213c28 (May 03, 2018) by Johannes Sixt ( j6t ) .
(Merger with Junio ​​C Hamano - gitster - committed by c9aac55 , May 23, 2018)

git : add -P as a short option for --no-Pager

You can configure a " less " pager, use an alternative screen to display content, for example, by setting LESS=RS in the environment.
When it is closed in this configuration, it switches to the original screen and all content disappears.

It is often requested that the output remains visible in the terminal. You can use the --no-Pager option for this.
But it's a little cumbersome to type, even when command is available.
Provide a short option -P to make this option more accessible.

+3
source

The -no-pager parameter gives an unrecognized option error when used after log , but it worked by putting --no-pager before log - "git --no-pager log ...." worked

0
source

All Articles