l a s
l a s

Reputation: 3921

Extract commit message using git rev-list

How to extract just the commit message using git rev-list command?

I tried git rev-list --format=%B --pretty=oneline -n 1 , but it prints the whole thing in 1 line.

Upvotes: 0

Views: 1214

Answers (1)

Rishi
Rishi

Reputation: 1183

$ git rev-list --format=%B --max-count=1 <commit>

would print out commit message and commit sha

$ git log --format=%B -n 1 <commit> | cat -

would print out commit message and no commit sha

Upvotes: 1

Related Questions