How to make git grep show at the top instead of the bottom of the terminal screen?
Suppose my terminal screen is 40 lines high.
Suppose I type in "clear";
Suppose the output if git grep is only 1- lines.
Now, the desired output I want is to have the first 1开发者_JS百科0 lines of my console be the output of git grep.
Instead, git grep fills in a bunch of blank lines and makes my output the bottom ten lines of the screen the output of git grep.
How can I fix this?
Are you looking for a way to have git grep
not show its output through a pager? Try:
GIT_PAGER='' git grep ...
git grep
sends its output through a pager, which you can disable by setting the GIT_PAGER
environment variable. I think what you are seeing is your pager displaying the text at the bottom of the screen, rather than git
doing so. If this is not what you want, we need to know more about what's happening.
Even if the question is a bit old, for further reference, I think the .gitconfig setting should be mentionned, here :
# ~/.gitconfig or .git/config
[pager]
grep = false
This will ensure you never use pager when using git grep
, without the need to add extra env variable.
You could pipe the output through grep like so:
<git command> | grep -v '^$'
Setting the GIT_PAGER Environment variable to '' will make all git commands output without the pager.
If you want it not to be paged only for a particular command, for example git grep, use it with git --no--pager
精彩评论