How should I use git diff for long lines?

Or if you use less as default pager just type -S while viewing the diff to reenable wrapping in less.


The display of the output of git diff is handled by whatever pager you are using.

Commonly, under Linux, less would be used.

You can tell git to use a different pager by setting the GIT_PAGER environment variable. If you don't mind about paging (for example, your terminal allows you to scroll back) you might try explicitly setting GIT_PAGER to empty to stop it using a pager. Under Linux:

$ GIT_PAGER='' git diff

Without a pager, the lines will wrap.

If your terminal doesn't support coloured output, you can also turn this off using either the --no-color argument, or putting an entry in the color section of your git config file.

$ GIT_PAGER='' git diff --no-color