I occasionally need to grep through git submodules for which I use:
git submodule foreach 'git grep x'
However, since switching to zsh I find a less prompt is opened for each submodule, even when there are no options. What I'd much prefer is for all of the output to be printed out to the terminal.
My current solution is to call:
git submodule foreach 'git grep x' > /tmp/a && cat /tmp/a
Which achieves what I want but I can't help but feel that I'm missing an option or a more elegant solution. Is there one?
Best Answer
Try changing the pager that git uses:
Or if you want less to be used, but only when output will run off of the screen:
You can set the pager per project by using
git config
, or you can, of course, set the environment variables globally.