First line of a commit msg

To test a commit msg, I need the contents of the first line.
With git rev-list --oneline I get the entire msg.
Only when the massages contain empty lines I get the content up to
This line.

Is there a query to get the first line?


I think this is what you’re looking for

git log --oneline --abbrev-commit

Just FYI the format and tformat options are pretty powerful and can pass stdout to scripts. There is also --grep which can filter just you want to see. The only negative is that you have to do it one commit at a time but you can wrap that in a for loop easily enough. Since it’s all local there is no down side.

From the git manual:
git log --pretty=tformat:%h 4da45bef | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'