I'm running git-diff on a file, but the change is at the end of a long line.
If I use cursor keys to move right it loses colour coding and worse the lines don't line up, making it harder to track the change.
Is there a way to prevent that problem, or to simply make the lines wrap instead?
(running git 1.5.5 via mingw32)
Since Git 1.5.3 (Sep 2007)
a
--no-pager
option has been available.How do I prevent git diff from using a pager?
Example
Starting with v2.1, wrap is the default
Git v2.1 Release Notes
Noone pointed out this till now. Its quite simple to remember and no extra configuration needs to be done in the git config
When in trouble, I often resort to DiffMerge. Excellent diff tool that has in-line diff highlighting. Also, in the latest versions they added a mode to have an horizontal mode.
I haven't been able to configure git to use it, though. So I do have to muck around to get both versions of the file first.
list the current/default config:
then update and leave out the -S like:
the -S: Causes lines longer than the screen width to be chopped rather than folded.
When you are using "git diff" and it's showing several pages(you see ":" at the end of the page)in this case you can type "-S" and press enter.(S should be capital). it will toggle fold long lines.
To use less as the pager and make line wrapping permanent you can simply enable the fold-long-lines option:
This way you do not have to type it while using less.
Cheers