How to wrap git commit comments?

Or you can change your pager to use less -R

$ git config --global core.pager 'less -R'

This will tell less to stop trying to control how the screen is formatted (you can normally scroll right and left during a git log using arrow keys). And as the less manual says “Thus, various display problems may result, such as long lines being split in the wrong place.” Which is what you want, you want the line ending to appear at the right of your screen (the wrong place) instead of where the comment author put it.

Also to note, pressing the right arrow key without modifying your pager, will let you see more of the code. Which is my preferred method.

Leave a Comment