tags:

views:

68

answers:

3

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 10 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?

+3  A: 

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.

Alok
Or `git --no-pager grep ...`
Jakub Narębski
+1  A: 

You could pipe the output through grep like so:

<git command> | grep -v '^$'
ar
A: 

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

Lakshman Prasad