在git中输出给定提交的提交信息 [英] Print commit message of a given commit in git
本文介绍了在git中输出给定提交的提交信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
推荐答案
这是一个管道命令,用于打印一个给定提交的提交消息 - 仅此而已。不是管道,但它会做你想要的:
It's not "plumbing", but it'll do exactly what you want:
$ git log --format=%B -n 1 <commit>
如果您确实需要管道命令(不知道为什么这是必需的),您可以使用 rev-list
:
If you absolutely need a "plumbing" command (not sure why that's a requirement), you can use rev-list
:
$ git rev-list --format=%B --max-count=1 <commit>
尽管 rev-list
也会打印出来除了提交消息外,还有提交sha(在第一行)。
Although rev-list
will also print out the commit sha (on the first line) in addition to the commit message.
这篇关于在git中输出给定提交的提交信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文