Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to force git's pager to wrap long lines?

On most machines where I use git, long lines in the output of commands like git diff and git show are wrapped.

On one machine, though, long lines are truncated, and I have to use the left and right arrow keys to scroll the screen horizontally. I don’t like this behavior at all, and I need to change it.

I assume this is a configuration variable in git’s pager, or something. Does anyone know what it is?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I have seen this inverse question but I haven’t been able to infer an answer to my question from it.


Update: I was under the impression that git had its own built-in pager. Experimentation with ps, however, suggests that on the machine where it works properly (does wrap) there’s a program /usr/bin/pager running, whereas on the machine where it’s "broken" (that is, requires horizontal scrolling), the running pager is less. So perhaps this is a less question, not a git question.

>Solution :

As it appears that the culprit is less AND the default of less in the source distribution is to wrap lines, this sounds like you have inherited a shell where this has been configured explicitly.

First of all you can toggle this by typing -S at the prompt.

Check for the presence of LESS environment variable, and whether it holds a value containing ‘S’. If so you need to adapt it to have +S.

On my Mac, this works:

export LESS=+S
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading