简体   繁体   English

使用git rev-list提取提交消息

[英]Extract commit message using git rev-list

How to extract just the commit message using git rev-list command? 如何使用git rev-list命令仅提取提交消息?

I tried git rev-list --format=%B --pretty=oneline -n 1 , but it prints the whole thing in 1 line. 我尝试了git rev-list --format =%B --pretty = oneline -n​​ 1,但是它以1行打印整个内容。

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

would print out commit message and commit sha 将打印出提交消息并提交sha

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

would print out commit message and no commit sha 将打印出提交消息,没有提交sha

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM