Git no pager for certain teams

I understand that you can do git --no-pager <command> to prevent the output from starting through the pager. I also understand that you can use, for example, git config --global core.pager cat .

However, there are some commands in which I want to use the pager automatically, for example. diff and others where I do not do this, for example. stash . Typing --no-pager every time is not as efficient as we would like.

Is it possible to configure this configuration for individual teams? Alternatively, can zsh automatically insert --no-pager when calling stash without using an alias?

+6
source share
2 answers

As this answer indicates , you can use pager.stash false to disable pagination for stash :

 git config --global pager.stash false 

More generally, you can use pager.<command> with other commands, such as diff

 git config --global pager.<command> false git config --global pager.diff false 

From the official Linux Git kernel documentation for git config :

 pager.<cmd> 

If the value is a boolean, pagination of a specific Git subcommand is turned on or off when writing to tty. Otherwise, paging for the subcommand is enabled using the pager specified by pager.<cmd> . If --paginate or --no-pager is specified on the command line, it takes precedence over this option. To disable pagination for all commands, set core.pager or GIT_PAGER to cat .

+6
source

You can use Git aliases:

 git config --global alias.nop-stash "stash --no-pager" 
0
source

Source: https://habr.com/ru/post/951316/


All Articles