Skip to contentSkip to conversation

git log: Add a switch to limit the number of displayed lines from the commit messages

DISCUSSION Paul Menzel 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Dear git folks,

there are people out there disliking elaborate commit messages, as going over git log is tedious as you have to scroll a lot. As I do not like the suggestion to make commit messages shorter by omitting certain details, a way to limit the number displayed lines of the commit messages would be nice to have.

The switch --format=oneline exists already. Unfortunately a lot of commits do not have a informative enough summary, so the first lines of the commit message are still needed/desired to understand the commit more.

Could a switch be added, like --commit-message-lines (sorry for not coming up with something better) to limit the number of displayed lines? That would be great!

For older git versions, do you know of editor/pager options to achieve this?

Thanks,

Paul

#1 lore raw

Hi Paul,

Quoted 5 lines · Paul Menzel

there are people out there disliking elaborate commit messages, as going over git log is tedious as you have to scroll a lot. As I do not like the suggestion to make commit messages shorter by omitting certain details, a way to limit the number displayed lines of the commit messages would be nice to have.

Have you tried gitk or tig? They split the screen so you can browse through commits, one per line, in one half and read the corresponding commit messages and patches in the other.

Hope that helps,
Jonathan

#2 lore raw
Quoted 9 lines · Jonathan Nieder
Quoted 5 lines

there are people out there disliking elaborate commit messages, as going over git log is tedious as you have to scroll a lot. As I do not like the suggestion to make commit messages shorter by omitting certain details, a way to limit the number displayed lines of the commit messages would be nice to have.

Have you tried gitk or tig? They split the screen so you can browse through commits, one per line, in one half and read the corresponding commit messages and patches in the other.

Or inside "less" that is spawned by "git log -p", I often say this:

    /^commit .*|^diff --git .*<ENTER>

and navigate with 'n' and 'p'.

#3 lore raw
Quoted 5 lines · Junio C Hamano

Or inside "less" that is spawned by "git log -p", I often say this:

    /^commit .*|^diff --git .*<ENTER>

and navigate with 'n' and 'p'.

Hm, that implies an interesting trick. If I run

	LESS='FRSX +/^commit |^diff --git ' git log -p

then 'n' and shift+'n' can be used for navigating without having to spell out the /pattern to start by hand.