Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to wrap git commit comments?

Tags:

git

Is there a way to wrap git commit comments (when viewed via git log), so they are not cut off at the end of the line? It seems like there should be a pretty simple solution, but I haven't been able to find one.

Thanks.

like image 590
David Avatar asked Jan 22 '10 19:01

David


People also ask

How long should git commit messages be?

The ideal size of a git commit summary is around 50 characters in length. Analyzing the average length of commit messages in the Linux kernel suggests this number.


1 Answers

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.

like image 139
Robert Avatar answered Oct 15 '22 15:10

Robert