I am trying to run git grep from terminal (using Titanium). The results do not wrap and get cut off at the window so I cannot read anything. I tried messing around with config but could not get anything. How can I make these grep results wrap?
Git Grep. Git ships with a command called grep that allows you to easily search through any committed tree, the working directory, or even the index for a string or regular expression. For the examples that follow, we'll search through the source code for Git itself.
The git grep version will only search in files tracked by git, whereas the grep version will search everything in the directory. So far so similar; either one could be better depending on what you want to achieve.
Have you set core.pager
in your .gitconfig
? If you are using less
, you can see the extra characters by pressing the right arrow key on the keyboard.
Edit: Even when I unset core.pager
, git grep
seems to invoke less -S
by default.
Edit 2: Whoops, as Keith Thompson pointed out less
does wrap lines by default. From the man page:
-S or --chop-long-lines Causes lines longer than the screen width to be chopped rather than folded. That is, the portion of a long line that does not fit in the screen width is not shown. The default is to fold long lines; that is, display the remainder on the next line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With